Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37958 > unrolled thread

derived class name in python 2.6/2.7

Started by"Sells, Fred" <fred.sells@adventistcare.org>
First post2013-01-30 20:05 +0000
Last post2013-01-30 20:05 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  derived class name in python 2.6/2.7 "Sells, Fred" <fred.sells@adventistcare.org> - 2013-01-30 20:05 +0000

#37958 — derived class name in python 2.6/2.7

From"Sells, Fred" <fred.sells@adventistcare.org>
Date2013-01-30 20:05 +0000
Subjectderived class name in python 2.6/2.7
Message-ID<mailman.1226.1359576407.2939.python-list@python.org>
This is simple, but I just cannot find it after quite a bit of searching

I have this basic design

class  A:
	def __init__(self):
		print 'I am an instance of ', self.__class__.name

class B(A):
	pass


X = B
I would like this to print "I am an instance of B"  but I keep getting A.  Can someone help me out here.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web