Underscores in Python numbers
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Sat Nov 19 13:01:22 EST 2005
Roy Smith>We already have a perfectly good syntax for entering octal
and hex integers,
There is this syntax:
1536 == int("600", 16)
that accepts strings only, up to a base of 36.
There are the hex() and oct() functions.
There is the %x and %o sintax, that isn't easy to remember.
There are the 0x600 and 0600 syntaxes that probably look good only from
the point of view of a C programmer.
I think some cleaning up, with a simpler and more consistent and
general way of converting bases, can be positive. But probably no one
shares this point of view, and compatibility with C syntax is probably
positive, so you are right. I am still learning the correct way of
thinking in python.
Bye,
bearophile
More information about the Python-list
mailing list