Integer literal is an object in Python?

Viewed 2064

Possible Duplicate:
accessing a python int literals methods

Everything in Python is an object. Even a number is an object:

>>> a=1
>>> type(a)
<class 'int'>
>>>a.real
1

I tried the following, because we should be able to access class members of an object:

>>> type(1)
<class 'int'>
>>> 1.real
  File "<stdin>", line 1
    1.real
         ^
SyntaxError: invalid syntax

Why does this not work?

4 Answers
Related