Octal notation: severe deprecation

Simon Brunning simon.brunning at gmail.com
Fri Jan 14 11:25:21 CET 2005

On Thu, 13 Jan 2005 16:50:56 -0500, Leif K-Brooks <eurleif at ecritters.biz> wrote:
> Tim Roberts wrote:
> > Stephen Thorne <stephen.thorne at gmail.com> wrote:
> >
> >>I would actually like to see pychecker pick up conceptual errors like this:
> >>
> >>import datetime
> >>datetime.datetime(2005, 04,04)
> >
> >
> > Why is that a conceptual error?  Syntactically, this could be a valid call
> > to a function.  Even if you have parsed and executed datetime, so that you
> > know datetime.datetime is a class, it's quite possible that the creation
> > and destruction of an object might have useful side effects.
> I'm guessing that Stephen is saying that PyChecker should have special
> knowledge of the datetime module and of the fact that dates are often
> specified with a leading zero, and therefor complain that they shouldn't
> be used that way in Python source code.

It would be useful if PyChecker warned you when you specify an octal
literal and where the value would differ from what you might expect if
you didn't realise that you were specifying an octal literal.

x = 04 # This doesn't need a warning: 04 == 4
#x = 09 # This doesn't need a warning: it will fail to compile
x= 012 # This *does* need a warning: 012 == 10

Simon B,
simon at brunningonline.net,

More information about the Python-list mailing list