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
--
[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
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
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'?
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'
[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.