class Vehicle:
speed = 0
def __init__(self, speed):
self.speed = speed
def drive(self, distance):
print 'need %f hour(s)' % (distance / self.speed)
print dir(Vehicle)
The Pycharm shows:
['__doc__', '__init__', '__module__', 'drive', 'speed']
But given that 'speed' is a member data, 'drive' is a member function, why are there no brackets after 'drive'?
How can I distinguish data member and function member with dir() in python?
If dir() only lists attribute names, then how can I list all the data members and methods in a class?Otherwise, when I want to call an attribute, how do I know whether it needs parentheses after the attribute name or not?
Is there a function simply show all the data member and method in a class directly