Assume:
>> a = 128
>> dir(a)
['__abs__', ..., '__xor__', 'bit_length', 'conjugate', 'denominator', 'imag', 'numerator', 'real']
The instruction:
>> dir(128)
['__abs__', ..., '__xor__', 'bit_length', 'conjugate', 'denominator', 'imag', 'numerator', 'real']
returns the same exactly previous result.
I can't explain why
>> a.bit_length()
8
works correctly but
>> 128.bit_length()
File "<stdin>", line 1
128.bit_length()
^
SyntaxError: invalid syntax
throws a SyntaxError.
The second 128 is "parsed" a new int
object should be created in memory. Why it can't access the method?