More elegant to get a name: o.__class__.__name__

Paul McGuire ptmcg at austin.rr._bogus_.com
Thu Nov 30 09:27:05 EST 2006


"alf" <ask at me> wrote in message 
news:z7mdnTF4I_wfefPYnZ2dnUVZ_rCdnZ2d at comcast.com...
> Hi,
> is there a more elegant way to get o.__class__.__name__. For instance I 
> would imagine name(o).
>
> -- 
> alf

>>> name = lambda o : o.__class__.__name__
>>> name(1)
'int'

Go for it!

-- Paul 





More information about the Python-list mailing list