Hi, On Thu, Aug 18, 2016 at 8:58 AM, ast <nomail@com.invalid> wrote: > Hello > > I wonder why calling a method on an integer > doesn't work ?
123 is not an integer. Its an integer constant. ;-) Thank you. > >>>> 123.bit_length() > > SyntaxError: invalid syntax > >>>> 123.to_bytes(3, 'big') > > SyntaxError: invalid syntax > > but it works with a variable > >>>> i = 123 >>>> i.bit_length() > > 7 > >>>> i=123 >>>> i.to_bytes(3, 'big') > > b'\x00\x00{' > > I am working with pyhton 3.5.1 > > thx > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list