PEP idea. ( removing __slots__ )

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


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

> The point is to combine __dict__ and __slots__ into a new __attribs__,
> the distinction being the type of __attribs__.  If you don't specify
> __attribs__ in the class you get the default __dict__ behavior, if you
> do, and use a tuple, then you get the __slots__ behavior, and you can
> easily tell which by checking the type, you could also iterate over
> the attributes without caring which it was.

So how is this different from the current situation? If you don't
specify __slots__, you get the default __dict__ behaviour, if you do,
and use a tuple, you get the __slots__ behaviour, and you can easily
tell which by checking the type.

You also have the case of both __slots__ and __dict__ being in a type,
and this is a useful case also.

Regards,
Martin





More information about the Python-list mailing list