What is Python's int?

Sometimes, int acts like a type:

print type(int)
<type 'type'>

But most often, we think of it as a function:

print int("5")
5

It's a class! When used in its functional form, it acts as a constructor, but otherwise is seen by the interpreter as a class.

Author: keith

Created: 2017-10-07 Sat 13:46

Validate