pyth at devel.trillke.net
Thu Jun 6 01:59:18 CEST 2002
IOW you cannot successfully wrap or inherit a dictionary type and pass it
to exec/eval :-(
Yes, I did also find a posting by Guido (didn't save the reference,
but it was via a google search) where he seemed to indicate that
subclassing list/dict other than add additional functionality (rather
than override core operations like lookups) could be problematic -
presumably because of cases like this where the special Python-exposed
functions are used. The message was during one of the later betas of
2.2, so I don't know if the viewpoint changed before final release.
everything is a google-search away if you know the right codewords :-)
I don't in this case, though ...
anyway, if you call dictionary methods from python you can intercept.
But either generally c-level code ignores python-overriden methods
or only eval/exec "optimizes" them out. I presume that this is for
speed reasons but there may lurk conceptual reasons as well. Who knows?
More information about the Python-list