Re: Getting a dictionary from an object
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Getting a dictionary from an object

From: Steven Bethard <steven.bethard@gmail.com>
Date: Sun Jul 24 2005 - 02:59:43 CEST

Thanos Tsouanas wrote:
> I would like to have a quick way to create dicts from object, so that a
> call to foo['bar'] would return obj.bar.
>
> The following works, but I would prefer to use a built-in way if one
> exists. Is there one?

Maybe I'm not understanding your problem, but have you looked at the
builtin "vars()"?

STeVe
Received on Thu Sep 29 17:07:55 2005