name of object inside it's methods?

Michal Wallace (sabren) sabren at manifestation.com
Sun Feb 27 13:03:28 EST 2000


On Sun, 27 Feb 2000 alv50855 at batman.tamucc.edu wrote:

> can someone fill in the blank
> 
> -------------------------------
> class Hello:
>     	def __init__(self, x):
>     	    	self.x = x
> 
>     	def classname(self):
>     	    	<blank>



def classname(self):
    return self.__class__


it'll actually return "__main__.Hello", but you could just look for the "."



Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





More information about the Python-list mailing list