PEP idea. ( removing __slots__ )

Martin v. Löwis martin at v.loewis.de
Sun Jul 6 15:14:10 EDT 2003


simon place <simon_place at whsmithnet.co.uk> writes:

> i can't think of a point for __slots__ except to save the overhead of
> a dict, this is why you DON'T HAVE a __dict__ when __slots__ is
> defined.

No. Some classes have slots for efficiency, and their subclasses have
dictionaries for generality.

Likewise, some classes have slots to save the dictionary for most
instances, but some instances may need additional attributes, in which
case Python creates the dictionary on-the-fly.

> The point of the combining is to simplify, you know, based on the idea
> that keeping the language simply ( and logical ) aids comprehension.

I know.

Regards,
Martin




More information about the Python-list mailing list