strange behavor....

Mark Wooding mdw at
Sun Nov 14 00:32:50 CET 2010

Dennis Lee Bieber <wlfraed at> 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

-- [mdw]

More information about the Python-list mailing list