[Python-3000] Octal
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Mar 14 06:38:27 CET 2007
Josiah Carlson wrote:
> Do we deprecate it followed by a later removal (so as to "resist the
> temptation to guess")? If so, sounds good to me (I've never had a use
> for octal literals).
I think that *some* syntax should be provided for octal
literals. They're useful when you're translating constants
from a C header file that are expressed in octal. I'd
suggest
0o123
except that the lower case 'o' might be a bit hard
to spot. :-(
Maybe something more general could be used to
indicate a number base, such as
1101(2) # binary
1234(8) # octal
1c3a(16) # hexadecimal
12g7(35) # why stop at 16?
Since calling a built-in integer never makes sense,
this would be unambiguous.
> Making them decimal instead, I think, would be a
> mistake.
Perhaps an all-digits literal with a leading zero
should be disallowed altogether. That ought to
prevent any accidents.
--
Greg
More information about the Python-3000
mailing list