Exploring Attributes and Methods

2008-03-06 Thread [EMAIL PROTECTED]
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. Thanks --

Re: Exploring Attributes and Methods

2008-03-06 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | 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

Re: Exploring Attributes and Methods

2008-03-06 Thread Tim Chase
Class Sample: fullname = 'Something' How can I know that this class has an attribute called 'fullname'? with the builtin hasattr() function :) class Sample: fullname='Something' ... hasattr(Sample, 'fullname') True -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Exploring Attributes and Methods

2008-03-06 Thread Paul McGuire
On Mar 6, 1:14 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 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'?

Re: Exploring Attributes and Methods

2008-03-06 Thread [EMAIL PROTECTED]
On Mar 7, 12:30 am, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | 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'

Re: Exploring Attributes and Methods

2008-03-06 Thread Diez B. Roggisch
[EMAIL PROTECTED] 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.