On Sun, 09 Nov 2008 11:34:37 +0100, spir wrote:
> Hello pyhonistas,
>
> Example:
> === module content ===
> a = 1
> b = 2
> ======================
>
> I'm looking for a way to get something like {'a':a, b':2}. Actually,
> names defind in the module will be instances of a custom type. I want to
> give them an attribute that holds their own name. E.g.: for key,obj in
> dict:
> obj.name = key
> _______________________________________________ Tutor maillist -
> [email protected]
> http://mail.python.org/mailman/listinfo/tutor
Are you looking for dir() (built-in function)
dir() -> returns names in current scope
dir(module/class/object) -> module/class/object's attributes
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor