*binarystar* wrote:
> 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
> 
> **

Hi,

take a look at self.__class__.__name__ for the Class-name.

HtH, Roland
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to