Can dictionary values access their keys?

Diez B. Roggisch deetsNOSPAM at web.de
Fri Apr 8 11:53:23 EDT 2005


> 
> Is there a way to do something like that with dicts?

Not without searching the dict's items through, or keeping a additional
mapping between values and keys.

> 
> On a similar note, if one object is part of another, is there a way for
> the 'child' obj to discover what/who the 'parent' object is? That way
> parent does not have to be explicityly passed to get_parent_index?

No. 
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list