__slots__

David Isaac aisaac0 at verizon.net
Thu Mar 23 02:06:56 EST 2006


1. "Without a __dict__ variable,
instances cannot be assigned new variables not listed in the __slots__
definition."

So this seemed an interesting restriction to impose in some instances,
but I've noticed that this behavior is being called by some a side effect
the reliance on which is considered unPythonic.  Why?

2. What is a simple example where use of slots has caused "subtle" problems,
as some claim it will?

3. What is a simple example of a Pythonic use of __slots__ that does NOT
involved the creation of **many** instances.

Thanks,
Alan Isaac





More information about the Python-list mailing list