You seem to be misunderstanding things. Classes introduce a separate namespace for themselves so, it is completely possible to create functions with the same name in different classes. These functions are not related in any other way other than their similar name.
Running <classname>.xyz()
simply calls xyz()
and prints the corresponding message.
Even if there was a relationship between the class, i.e a sub-classing relationship of the form:
class abc:
@staticmethod
def xyz():
print 'class_abc'
class abc1(abc):
@staticmethod
def xyz():
print 'class_abc1'
class abc2(abc1):
@staticmethod
def xyz():
print 'class_abc2'
The most recent definition of xyz
will override previously existing entries for it and the effect would be the same, that is abc2.xyz()
would print class_abc2
, abc1.xyz()
prints class_abc1
and so on.
Also, do note, you're using Python 2.x
but aren't actually inheriting from object
. This won't create a class in the sense most people are aware with today, take a look at What is the difference between old style and new style classes in Python? to get a better idea of what this entails.