printing class __dict__

  • Thread starter piyush.subscription
  • Start date
P

piyush.subscription

hi,
i am a newbie. so bear wth me
i wrote a program like this
--
class H(object):
def __init__( self):
self.data =10
def e ( self ):
pass
def f ( self ):
pass

class H1(H):
x2 = 11
def __init__(self):
self.x = 10

class details(object):
def data(self,className):
print classname.__dict__
print classname.__name__
print classname.__bases__

bc = details()
bc.data(H1)

when i run it, i get error like this
NameError: global name 'classname' is not defined

can't i pass 'class' like an 'object'?

any suggestions to access other classes details inside a class?
 
D

Diez B. Roggisch

hi,
i am a newbie. so bear wth me
i wrote a program like this
--
class H(object):
def __init__( self):
self.data =10
def e ( self ):
pass
def f ( self ):
pass

class H1(H):
x2 = 11
def __init__(self):
self.x = 10

class details(object):
def data(self,className):
print classname.__dict__
print classname.__name__
print classname.__bases__

bc = details()
bc.data(H1)

when i run it, i get error like this
NameError: global name 'classname' is not defined

can't i pass 'class' like an 'object'?

any suggestions to access other classes details inside a class?

Python is case-sensitive. Now analyze your code.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top