strange behavor....
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Nov 13 17:52:52 EST 2010
On Sat, 13 Nov 2010 14:37:44 -0800, Dennis Lee Bieber wrote:
> On Sat, 13 Nov 2010 16:29:19 +0000, mdw at distorted.org.uk (Mark Wooding)
> declaimed the following in gmane.comp.python.general:
>
>
>> to a function argument /never/ affects the caller in Python. It's
>> simply not possible to write a `swap' function in Python. The latter
>> means that a value itself changes but the relevant variables continue
>> to store the same values.
>>
> I disagree (borrowing FORTRAN and Ada terms)...
>
> You can not write a "swap" PROCEDURE in Python... PROCEDUREs do
not
> return values except via side-effects on the arguments. FUNCTIONs
> however, do return values as the function result...
Ha, excellent point!
But in fairness, in context he was talking about a function that operates
purely by side-effects -- what Pascal, Fortran or Ada would call a
procedure.
--
Steven
More information about the Python-list
mailing list