__bases__ attribute on classes not displayed by dir() command
ast
nomail at invalid.com
Thu Feb 4 03:03:35 EST 2016
Hi
I have a Carre class which inherit from a Rectangle class.
Carre has a __bases__ tuple attribute which contains the
classes which it inherit from.
>>> Carre.__bases__
(<class '__main__.Rectangle'>,)
and Rectangle only inherit from object, so:
>>> Rectangle.__bases__
(<class 'object'>,)
Thats OK
but if I am using dir to display all Carre's attributes and methods,
__bases__ is not on the list. Why ?
>>> dir(Carre)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__',
'__format__', '__ge__', '__getattribute__', '__gt__', '__hash__',
'__init__', '__iter__', '__le__', '__lt__', '__module__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'aire',
'count', 'long', 'perimetre', 'rotation']
More information about the Python-list
mailing list