Numeric literals in other than base 10 - was Annoying octal notation
maxerickson at gmail.com
Mon Aug 24 03:19:53 CEST 2009
"bartc" <bartc at freeuk.com> wrote:
> "Scott David Daniels" <Scott.Daniels at Acm.Org> wrote in message
> news:kN2dnSZR5b0BWAzXnZ2dnUVZ_s-dnZ2d at pdx.net...
>> James Harris wrote:...
>>> Another option:
> It can be assumed however that .9. isn't in binary?
> That's a neat idea. But an even simpler scheme might be:
> until it gets to this anyway:
At some point, abandoning direct support for literals and just
having a function that can handle different bases starts to make a
lot of sense to me:
>>> int('100', 8)
>>> int('100', 10)
>>> int('100', 16)
>>> int('100', 2)
>>> int('100', 3)
>>> int('100', 36)
More information about the Python-list