[Python-Dev] A new dict for Xmas?

Dirkjan Ochtman dirkjan at ochtman.nl
Sat Dec 17 13:31:01 CET 2011

On Sat, Dec 17, 2011 at 12:53, Maciej Fijalkowski <fijall at gmail.com> wrote:
> 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.

Yeah... This whole idea reeks of polymorphic inline caches (called
"shapes" or "hidden classes" in SpiderMonkey and v8, respectively),
where they dynamically try to infer what kind of class an object has,
such that the __slots__ optimization can be done without making it
visible in the semantics. The Unladen Swallow guys mention in their
ProjectPlan that the overhead of opcode fetch/dispatch makes that
hard, though.



More information about the Python-Dev mailing list