Python Source Code Beautifier

Alan Franzoni alan.franzoni_invalid at geemail.invalid
Wed Mar 7 14:29:29 CET 2007

Il Tue, 06 Mar 2007 01:55:54 -0300, Gabriel Genellina ha scritto:

> The problem is that other people -not necesarily "smarter and more  
> experienced" than you- may use those features, and perhaps you have to  
> read, understand and modify some code written by someone else.
> So, you should at least know what "a += b" means, even if you are not  
> going to use it.

That's sure, and I'm in fact glad to know that by now. I still think it's
risky, BTW. Python is dynamically typed, after all, and there's no 'a
priori' way to know if 'a' is a list or another type, especially another
container type.

If we rely on duck typing, by the way, we may encounter two types quacking
like ducks, flying like ducks, but in fact acting as slightly different
ducks. I should remember as well, when designing a container type that I
want to use in place of a list, to carefully craft an __iadd__ method which
works just like the a list's own __iadd__ method; if I forget, I may
introduce a subtle error. 

Alan Franzoni < at>
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