Return value of an assignment statement?

Jeff Schwab jeff at schwabcenter.com
Sat Feb 23 05:59:45 EST 2008


Dennis Lee Bieber wrote:
> On Fri, 22 Feb 2008 11:23:27 -0800, Jeff Schwab <jeff at schwabcenter.com>
> declaimed the following in comp.lang.python:
> 
> 
>> I'm about through with this discussion, but FWIW, this is a real gotcha 
>> for me and many others.  This is a case where Python does not do what 
>> many programmers expect, and it at least takes some getting used-to.
> 
> 	As opposed to the twice monthly shocked newbie discovering that a
> mutable as a function default doesn't reset on the next invocation?
> 
> 	In that aspect, it all comes down to the difference between mutables
> and immutables in Python.

You know what's illuminating the discussion?  Everybody thinks they 
understand this issue, but the explanations are contradictory.  It seems 
like half the folks think this is an issue of mutability vs. 
immutability, and the other half believe that has nothing to do with it.



More information about the Python-list mailing list