Python Source Code Beautifier

Alan Franzoni alan.franzoni_invalid at geemail.invalid
Wed Feb 28 11:24:05 EST 2007


Il 27 Feb 2007 16:14:20 -0800, sjdevnull at yahoo.com ha scritto:

> Those mean different things:
> 
>>>> a=[1]
>>>> b=a
>>>> a += [2]
>>>> a
> [1, 2]
>>>> b
> [1, 2]
>>>> a=[1]
>>>> b=a
>>>> a = a + [2]
>>>> a
> [1, 2]
>>>> b
> [1]

This is a really nasty one! I just answered to Tim above here, and then I
saw your example... I had never realized that kind of list behaviour.
That's probably because i never use + and += on lists (i prefer the more
explicit append() or extend() and i do copy list explictly when I want to)
, BTW I think this behaviour is tricky!


-- 
Alan Franzoni <alan.franzoni.xyz at gmail.com>
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E 



More information about the Python-list mailing list