Annoying octal notation
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Mon Aug 24 13:03:28 EDT 2009
On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote:
> since the old
> syntax is prevalent both within and without the Python community, making
> the change is, was, and always will be a bad idea.
Octal syntax isn't prevalent *at all*, except in a small number of niche
areas.
You've said that this change is a hardship for you, because on your
terminal 0 and o are hard to distinguish. Personally, I'd say that's a
good sign that your terminal is crappy and you should use a better one,
but putting that aside, let's accept that. To you, for whatever reason,
0o looks just like 00.
Okay then. Under the current 2.x syntax, 0012 would be interpreted as
octal. Under the new 3.x syntax, 0o12 which looks just like 0012 also
would be interpreted as octal. You have argued that it might not be any
harder to type the extra 'o' to get an octal literal, but that it will
hurt readability. I quote:
"Writing 0o12 presents no hardship; but I assert, with at least some
support from others here, that *reading* it does."
But according to you, reading 0o12 is just like reading 0012. 0o12 under
the new syntax gives decimal ten, and it looks just like 0012 in the old
syntax, which also gives ten. So there's no difference in reading, and
you've already accepted that the extra effort in writing it "presents no
hardship".
A whole lot of noise over a change which is more or less invisible.
--
Steven
More information about the Python-list
mailing list