Cannot pass UserDict to eval()?

Mark Hammond MarkH at ActiveState.com
Tue Aug 15 19:56:03 EDT 2000


> Why are instances not allowed?

2 reasons.  Real dicts predate the arbitary mapping sequences.

But the real show-stopper is speed.  Dictionaries as namespaces are
crucial to Python, and we find dictionary access in some of the most
speed critical parts of Python.  Code that assumes a dictionary will
be faster than code that goes via the abstract mapping protocol.

Basically, there is agreement in principal that this should possibly
happen, but it is too much effort to do it today while not dropping
any speed.

Asked-for-this-years-ago ly,

Mark.






More information about the Python-list mailing list