Annoying octal notation
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Mon Aug 24 20:37:36 EDT 2009
On Mon, 24 Aug 2009 12:40:24 -0500, Derek Martin wrote:
> On Mon, Aug 24, 2009 at 05:03:28PM +0000, Steven D'Aprano wrote:
>> 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.
>
> Steven, don't be obtuse. Where octal is used in programming, the
> leading zero is prevalent.
Now who is being obtuse? If you take *any* feature at all, no matter how
rare, you can say "Where it is used, it is prevalent". Among people who
program in Whitespace, all three of them, the use of spaces and tabs as
significant programming tokens is prevalent.
This whole argument is over whether or not a "feature" desired by a tiny
proportion of the programming community -- the intersection of those who
use octal frequently enough that using an extra 'o' is a hardship, and
those who use C-based languages -- should hold *everyone else* hostage to
their badly thought out notation.
[...]
> Why is it so hard for you to accept that intelligent people can disagree
> with you, and that what's right for you might be bad for others?
I can accept that intelligent people can disagree with me. I even
sympathise with you, that you're one of the minority who don't find octal
archaic and unnecessary, and you'll need to learn a new syntax for octal
literals in Python 3.x. But your argument is fundamentally "but we've
always done it this way, and other languages do it, so why should we
change?". We should change because the desire to prevent silent errors
caused by (e.g.) 012 being interpreted as 10, and the desire to be
consistent with both mathematical notation and floating point syntax
outweighs the need to be backward compatible.
This change was not a spur of the moment thing, it went through the
entire PEP process with due concern for backward compatibility, which
Python does *not* change without good reason. You lost, get over it. I'm
sorry that you personally find this change a hardship, but HTFU. If and
when you move to Python 3.x, you'll get used to it. If you can get used
to putting braces around code blocks in C and braces around dicts in
Python, you're more than capable of getting used to writing 012 in C and
0o12 in Python.
--
Steven
More information about the Python-list
mailing list