[ python-Bugs-1248658 ] dir should accept dirproxies for __dict__

SourceForge.net noreply at sourceforge.net
Sun Jul 31 15:24:18 CEST 2005


Bugs item #1248658, was opened at 2005-07-31 15:21
Message generated for change (Settings changed) made by ronaldoussoren
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1248658&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Python Interpreter Core
>Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ronald Oussoren (ronaldoussoren)
Assigned to: Nobody/Anonymous (nobody)
Summary: dir should accept dirproxies for __dict__

Initial Comment:
PyObject_Dir checks if the __dict__ of an object is a dict, if not it is 
ignored. It should also accept dictproxies.

My usecase is an object that doesn't have a real dict, but looks up 
attributes in another datastructure. When someone asks for the 
__dict__ of this object I'm dynamicly building a new dictionary. I'd 
like the __dict__ property to be a immutable value because changing 
it won't (and shouldn't) affect the underlying object. 

However, when I return the result of a call to PyDict_NewProxy the 
builtin function dir will no longer use the contents of the __dict__ 
attribute, which is counterproductive because supporting dict is a 
major usecase for supporting a __dict__ attribute in the first place!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1248658&group_id=5470


More information about the Python-bugs-list mailing list