[Python-Dev] A new dict for Xmas?

Maciej Fijalkowski fijall at gmail.com
Sat Dec 17 12:53:05 CET 2011


On Fri, Dec 16, 2011 at 11:32 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 12/16/2011 5:03 AM, Mark Shannon wrote:
>
>> Of course using __slots__ saves more memory,
>> but people don't use them much.
>
>
> Do you think the stdlib should be using __slots__ more?

Note that unlike some other more advanced approaches, slots do change
semantics. There are many cases out there where people would stuff
arbitrary things on stdlib objects and this works fine without
__slots__, but will stop working as soon as you introduce them. A
change from no slots to using slots is not only a performance issue.

Cheers,
fijal


More information about the Python-Dev mailing list