Little question: are int
, float
, bool
, list
, str
, etc. actual classes in python? For example, if we write x = 5
we create an instance of a class int
and assign this instance to a variable x
. Am I correct?
Asked
Active
Viewed 52 times
2

trollpidor
- 447
- 5
- 11
-
1Yes, that's correct (except that small integers are *interned* in CPython, so `x = 5` would assign an existing `int` instance to the identifier `x`). – jonrsharpe May 13 '15 at 21:20
-
Please take a look in the Python documentation: https://docs.python.org/2/library/stdtypes.html#built-in-types – alfakini May 13 '15 at 21:23