var or inout parm?

Chris Rebert clp at
Sat Dec 13 00:28:13 CET 2008

On Fri, Dec 12, 2008 at 4:56 AM, sturlamolden <sturlamolden at> wrote:
> On Dec 12, 1:44 pm, "Chris Rebert" <c... at> wrote:
>> Python begs to differ, as those two statements are both semantically
>> identical in this case:
> That is because integers are immutable. When x += 1 is done on an int,
> there will be a rebinding. But try the same on say, a numpy array, and
> the result will be different:

Yes, I know that. Did you not read the end of my email? Here it is again:

If you were talking about lists rather than integers though, you'd be
absolutely correct, as the += ends up being a method call to __iadd__
instead of a plain assignment.


Follow the path of the Iguana...

More information about the Python-list mailing list