I apologize - I had forgotten what you were telling me by the time I 
replied. Here's a better answer.

> Phillip J. Eby wrote:
>> At 03:26 PM 12/3/2007 -0700, Neil Toronto wrote:
>> Actually, you're missing the part where such evil code *can't* muck 
>> things up for class dictionaries.  Type dicts aren't reachable via 
>> ordinary Python code; you *have* to modify them via setattr.  (The 
>> __dict__ of types returns a read-only proxy object, so the most evil 
>> rich compare you can imagine still can't touch it.)

C code can and does alter tp_dict directly already. If caching were 
implemented within type's setattr, all these places would have to be 
changed to use setattr only. That doesn't seem so bad at first. It's a 
change in convention, certainly: a new informal rule that says "no 
monkeying with a PyTypeObject's tp_dict, period". Lack of observance 
could be difficult to debug, as a PyDict_SetItem would appear to have 
worked just fine to C code but not show up to Python code.

Neil

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to