On 13/6/2013 11:20 πμ, Chris Angelico wrote:
On Thu, Jun 13, 2013 at 6:08 PM, Νικόλαος Κούρας <supp...@superhost.gr> wrote:
On 13/6/2013 10:58 πμ, Chris Angelico wrote:
On Thu, Jun 13, 2013 at 5:42 PM, �������� ������ <supp...@superhost.gr>
wrote:
On 13/6/2013 10:11 ��, Steven D'Aprano wrote:
No! That creates a string from 16474 in base two:
'0b100000001011010'
I disagree here.
16474 is a number in base 10. Doing bin(16474) we get the binary
representation of number 16474 and not a string.
Why you say we receive a string while python presents a binary number?
You can disagree all you like. Steven cited a simple point of fact,
one which can be verified in any Python interpreter. Nikos, you are
flat wrong here; bin(16474) creates a string.
Indeed python embraced it in single quoting '0b100000001011010' and not as
0b100000001011010 which in fact makes it a string.
But since bin(16474) seems to create a string rather than an expected
number(at leat into my mind) then how do we get the binary representation of
the number 16474 as a number?
In Python 2:
16474
typing 16474 in interactive session both in python 2 and 3 gives back
the number 16474
while we want the the binary representation of the number 16474
--
http://mail.python.org/mailman/listinfo/python-list