#python #scip
Non-pure functions. In addition to returning a value, applying a non-pure
function can generate side effects, which make some change to the state of the
interpreter or computer. A common side effect is to generate additional output
beyond the return value, using the print function.
If you want to change selection, open document below and click on "Move attachment"
1.2 Elements of Programmings output.
The function abs is pure. Pure functions have the property that applying
them has no effects beyond returning a value. Moreover, a pure function must
always return the same value when called twice with the same arguments.
<span>Non-pure functions. In addition to returning a value, applying a non-pure
function can generate side effects, which make some change to the state of the
interpreter or computer. A common side effect is to generate additional output
beyond the return value, using the print function.
>>> print(1, 2, 3)
1 2 3
While print and abs may appear to be similar in these examples, they
work in fundamentally different ways. The value that print returns is
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details