__class__ for 2.2 types

Michael Chermside mcherm at destiny.com
Thu Feb 7 16:24:09 EST 2002


> hi, rookie here, I was hoping someone could explain to me why this happens:
> 
> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> [].__class__
> <type 'list'>
>>>> int.__class__
> <type 'type'>
> 
> why doesn't the int one return <type 'int'>? 
> 
> thanks in advance
> 


Because "int" isn't an int. "5" is.


>>> [].__class__
<type 'list'>
>>> x = 7
>>> x.__class__
<type 'int'>


>>> int.__class__
<type 'type'>
>>> str.__class__
<type 'type'>







More information about the Python-list mailing list