strange behavor....
Mark Wooding
mdw at distorted.org.uk
Sat Nov 13 18:32:50 EST 2010
Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> def swapFunc(a, b):
> return b, a
That's not what a `swap' function should do.
> > Alas, Python is actually slightly confusing here, since the same
> > notation `=' sometimes means assignment and sometimes means mutation.
>
> "=" means just one thing, a rebinding of some identifier to a
> different object.
Names aren't bound to objects. See elsewhere.
> Or, in more general, "=" rebinds the fully qualified name to a
> different object, which has the result of mutating a partially qualified
> name (a name whose suffix has be removed).
Names aren't mutated at all. Values (or, synonymously, objects) are
mutated.
-- [mdw]
More information about the Python-list
mailing list