Author daniel.urban
Recipients daniel.urban, rhettinger, stutzbach
Date 2011-02-26.12:24:32
SpamBayes Score 2.02955e-05
Marked as misclassified No
Message-id <1298723074.18.0.581998347487.issue11333@psf.upfronthosting.co.za>
In-reply-to
Content
Currently instances of classes which inherit an ABC in collections.abc will have a __dict__.  This can be a problem for example a tree-like data structure. It would make sense to inherit for example MutableMapping, but that would possibly mean, that every node in the tree would have a __dict__, which is probably a waste of memory.

A workaround for this problem is not inheriting the ABC, and using ABCMeta.register (and optionally adding the mixin methods explicitly), but this feels like a hack.

The attached patch adds an empty __slots__ to the ABCs in collections.abc.  I excluded the mapping views (MappingView, KeysView, ItemsView and ValuesView), because they can't have an empty __slots__, and I think using a nonempty __slots__ possibly can cause problems in some cases with multiple inheritance.
History
Date User Action Args
2011-02-26 12:24:34daniel.urbansetrecipients: + daniel.urban, rhettinger, stutzbach
2011-02-26 12:24:34daniel.urbansetmessageid: <1298723074.18.0.581998347487.issue11333@psf.upfronthosting.co.za>
2011-02-26 12:24:33daniel.urbanlinkissue11333 messages
2011-02-26 12:24:33daniel.urbancreate