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

2006-12-08 Thread alf
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

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

2006-12-01 Thread George Sakkis
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

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

2006-11-30 Thread Paul McGuire
"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

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

2006-11-30 Thread Carl Banks
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