Leading 0's syntax error in datetime.date module (Python 3.6)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 10 23:16:51 EDT 2018


On Thu, 10 May 2018 17:36:39 +0100, bartc wrote:

> I wonder why someone would take a feature generally agreed to be a
> poorly designed feature of C, and incorporate it into a new language.

Because in 1991 or thereabouts, when Guido was designing the language for 
the first time, he thought it was a good idea since Python was intended 
to be a glue language to act as an interface to C libraries, and he 
probably imagined it would mostly be used by people familiar with C.

In hindsight that turned out to be one of the less great ideas, but the 
only people who have no bad ideas are those who have no ideas at all.


>> That changed in Python 3. If you slim
>> the start of PEP 3127, you'll learn the new notation.
> 
> What, 0O100 instead of 0100? Yeah that's a big improvement...

Then write it as 0o100 like sensible people do.


> Fortunately octal doesn't get used much.

Indeed.


-- 
Steve




More information about the Python-list mailing list