Exploring Attributes and Methods

Diez B. Roggisch deets at nospam.web.de
Thu Mar 6 15:19:54 EST 2008


keios.titan at gmail.com schrieb:
> Hi,
>  Is there a python command that allows me to extract the names (not
> values) of the attributes of a class.
> 
> example
> 
> Class Sample:
>     fullname = 'Something'
> 
> How can I know that this class has an attribute called 'fullname'?
> 
> I hope my question is clear.

The question others have answered already. But I have one for you: you 
are aware that these kind of variables are *class variables*, NOT 
*instance variables*, as they are created like this:


class Foo(object):
     def __init__(self):
         self.fullname = "something"


Diez



More information about the Python-list mailing list