alf wrote:
> Hi,
> is there a more elegant way to get o.__class__.__name__. For instance I
> would imagine name(o).
>
decided to stick to o.__class__.__name__ for readibility.
--
alfz1
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
> alf wrote:
> > Hi,
> > is there a more elegant way to get o.__class__.__name__. For instance I
> > would imagine name(o).
>
> def name_of_type(o):
> return o.__class__.__name__
>
> name_of_type(o)
>
>
> Carl Banks
>
> P.S. name(o) suggests it's the name of the object, not t
"alf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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
--
http://mail.python.org
alf wrote:
> Hi,
> is there a more elegant way to get o.__class__.__name__. For instance I
> would imagine name(o).
def name_of_type(o):
return o.__class__.__name__
name_of_type(o)
Carl Banks
P.S. name(o) suggests it's the name of the object, not the type
P.P.S. you could use type(o).__na