Getting a dictionary from an object

Thanos Tsouanas thanos at sians.org
Sat Jul 23 19:09:54 EDT 2005


On Sat, Jul 23, 2005 at 11:22:21PM +1000, Steven D'Aprano wrote:
> On Sat, 23 Jul 2005 11:48:27 +0300, Thanos Tsouanas wrote:
> > Hello.
> > 
> > I would like to have a quick way to create dicts from object, so that a
> > call to foo['bar'] would return obj.bar.
> 
> That looks rather confusing to me. Why not just call obj.bar, since it
> doesn't look like you are actually using the dictionary at all?
> 
> > [...]
> 
> I don't think this is particularly useful behaviour. How do you use it?

print foo %do

where do is a dictobj object...

-- 
Thanos Tsouanas          .: My Music: http://www.thanostsouanas.com/
http://thanos.sians.org/ .: Sians Music: http://www.sians.org/



More information about the Python-list mailing list