Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to get list of Python class properties. So I could make base class with function to get dict with all class properties name and value but without specifying exact properties.

share|improve this question

closed as off topic by Stefano Palazzo Jan 11 '12 at 12:58

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Possibly this would be better located at StackOverflow? –  WarriorIng64 Jan 11 '12 at 8:45
    
You can have your class inherit from UserDict and subclass it that way: docs.python.org/library/userdict.html By the way, this is the wrong site for such questions. Like Warrioring says, you should ask on Stack Overflow next time. –  Stefano Palazzo Jan 11 '12 at 12:58
    
Thank You ...and sorry. –  marcinpz Jan 11 '12 at 14:01

1 Answer 1

properties = some_class.__dict__

## for example,

a = str.__dict__
b = int.__dict__
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.