Introspection Class/Instance Name
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Introspection Class/Instance Name

From: *binarystar* <binarystar.@binarystar.org>
Date: Wed Apr 26 2006 - 07:58:30 CEST

Hello there,

what method would you use to return the name of the class and/or
instance introspectively eg.

class Bollocks:
        
        def __init__( self ):
                
                print self.__method_that_returns_class_name__()
                print self.__method_that_returns_instance_name__()

instance_of_bollocks = Bollocks()

# Which outputs

'Bollocks'
'instance_of_bollocks'

I have been scouring the 2.4 docs ... I am sure it is frustratingly simple

thx in advance

**
Received on Mon May 1 00:19:18 2006