Does Python really follow its philosophy of "Readability counts"?

Paul Rubin http
Wed Jan 14 19:02:44 EST 2009


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> Not accidental, but people complain if you use slots for the purpose of 
> prohibiting attribute creation. They say "That's not what __slots__ was 
> designed for!". That's okay though, computers were designed for breaking 
> Germany ciphers and calculating the trajectory of cannon-shells, but 
> they're not the only things we use computers for these days.

It's hard to figure out from the docs exactly what slots is supposed
to do:

  http://docs.python.org/reference/datamodel.html#id3

I don't think it's good style to rely on accidental, undocumented
characteristics of some language feature.  But, I may start using
slots for some of the stuff I'm doing, just to reduce space
consumption and keep more instances around, which is what it's really
intended for.



More information about the Python-list mailing list