Python Source Code Beautifier

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


Il Wed, 28 Feb 2007 07:53:47 +1100, Delaney, Timothy (Tim) ha scritto:

> Alan Franzoni wrote:
>> the += operator is syntactic sugar just to save time... if one
>> doesn't use it I don't think it's a matter of beauty.
> 
> This change can have semantic differences, and so should not be done for
> anything except basic, immutable objects (such as integers). As such, it
> can't be done automatically.

Yeah, that's right, it could have semantic differences, but that shouldn't
be the case anyway. I mean, if I don't define an __iadd__ method, writing

a += n

or

a = a + n

is just the same, right?


So, if I bother to define an __iadd__ method, I should make sure it works
just the same, or I would introduce a very strange and hard-to-understand
behaviour.



-- 
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