You can't add methods to integers in Python, but they're still objects in the sense that you can call methods on them:
>>> i = 123
>>> i.bit_length()
7
>>> i = 123
>>> i.bit_length()
7
>>> def f(self):
... return self
...
>>> (3).f
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'f'You can't call `f` as a method of any object, because in Python (unlike Ruby) the top-level namespace is unrelated to the namespaces of any classes.