[Tutor] isinstance -> instance
Alan Gauld
alan.gauld at btinternet.com
Mon Feb 26 23:14:45 CET 2007
"Bernard Lebel" <3dbernard at gmail.com> wrote
> class A:
> def __init__( self ):
> self.a = 'a'
>
> a = A()
>
> print type( a )
>
> Outputs:
> <type 'instance'>
So use types.Instancetype
import types as t
>>> class A: pass
...
>>> a = A()
>>> type(a)
<type 'instance'>
>>> type(A)
<type 'classobj'>
>>> type(a) == t.InstanceType
True
>>>
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list