[Tutor] Re : Is instance of what?

spir denis.spir at free.fr
Sun Feb 1 10:51:55 CET 2009


Le Sat, 31 Jan 2009 15:00:02 -0500,
Kent Johnson <kent37 at tds.net> a écrit :

> On Sat, Jan 31, 2009 at 2:47 PM, spir <denis.spir at free.fr> wrote:
> 
> >> > o.__class__ (or rather o.__class__.__name__) will work.
> >> Understood. Thank you.
> >> tj
> >
> > type(a) has been changed (since 2.2?) to return the same value as a.__class__
> 
> I think you mean type(o) (type of the instance) rather than type(a)
> (type of the class object).
> type(o) == o.__class__ is only true if o is an instance of a new-style
> class. Instances of oldstyle classes all have type 'instance'.
> 
> Kent
> 
You're right, Kent! I haven't paid enough attention to a/o. Thanks also for the precision about old style classes' instances.
By the way, don't your fingers find "isinstance" difficult to type? Mine always write typos ;-)

Denis

------
la vida e estranya


More information about the Tutor mailing list