Q:

len(bytes(1000)) takes 1000 bytes in memory?

I tested the integer with the following codes:
In [10]: bin(5)
Out[10]: '0b101'
In [11]: bytes(5)
Out[11]: b'\x00\x00\x00\x00\x00'

Then I checked the length of bytes(5)
In [13]: len(bytes(5))
Out[13]: 5

In [14]: len(bytes(1000))
Out[14]: 1000

Does it mean that integer 1000 take 1000 bytes in memory?
And integer 1000 is 250 times more expensive than "text"?

A:

bytes(5) creates a bytes object with 5 bytes, each initialized to '\x00' (a null byte). It does not create an integer 5.
The len function returns the number of elements in a container object. To check the memory footprint of an object you should instead use the sys.getsizeof method:
>>> import sys
>>> sys.getsizeof(bytes(5)) # memory footprint of a bytes object with a length of 5
22
>>> sys.getsizeof(5) # memory footprint of the integer 5
14
>>>

