I have the following test code setup, trying to get the class name of a
subclass in the super class. (Reason why i want this is described below)
file class_name_start.py
import class_name as cn
obj = cn.B()
obj.printclass()
file class_name.py
flupke [EMAIL PROTECTED] wrote:
I have the following test code setup, trying to get the class name of a
subclass in the super class. (Reason why i want this is described below)
file class_name_start.py
import class_name as cn
obj = cn.B()
obj.printclass()
George Sakkis wrote:
snip
Make printclass a class method:
class A(object):
def __init__(self):
print I'm A
# for python 2.4
@classmethod
def printclass(cls):
print Module, cls.__module__
print Class, cls.__name__
# for 2.3 or older
On Wed, 20 Jul 2005 14:06:57 GMT,
flupke [EMAIL PROTECTED] wrote:
file class_name.py
class A(object):
def __init__(self):
print I'm A
def printclass(self):
print Name ,__name__
print Class ,A.__name__
Why A.__name__ and not