__class__ for 2.2 types

Thomas Heller thomas.heller at ion-tof.com
Thu Feb 7 15:50:09 EST 2002


"Larry" <wrbt at email.com> wrote in message news:2ec1bc1c.0202071240.44185531 at posting.google.com...
> 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'>?

int is the *type* of an integer, not an integer itself.

See:

>>> list.__class__
<type 'type'>
>>> 2.__class__
  File "<string>", line 1
    2.__class__
              ^
SyntaxError: invalid syntax
>>> 2 . __class__
<type 'int'>
>>>

Thomas





More information about the Python-list mailing list