[Python-3000] Fwd: Re: Octal

Raymond Hettinger python at rcn.com
Wed Mar 14 20:18:03 CET 2007


[Patrick Maupin]>
>So just to couch it all in terms of a proposal:
>
>- In 2.6 and 3.0, we add 0t1234 as a valid octal number
>- In 2.6, we issue a deprecation warning for a leading literal 0 which
>is followed immediately by another digit.
>- In 3.0, that becomes an exception

My suggestion:

- In 2.6 and 3.0, add 0t1234 as a valid octal number

- In 2.6, use the special 3.0 warning gizmo that is off by default and only turned-on with a command-line switch.  A normal deprecation warning is unwarranted and irritating; besides, we do intend leave the existing notation intact in the 2.x series.

- In 3.0, we don't want an exception.  With floats and decimals, leading zeroes are allowed (i.e.  0.123).  In 3.0, I would like the leading zero distinction to disappear from our collective memory.  Somelike like eval('00987') should give 987, not an exception.  The use cases for zfill() correspond to the cases where leading zeros are meaningfully interpreted as decimals (this includes phone and social security numbers, account numbers, and whatnot).

- Enhance the 2-to-3 conversion tool to move 0123 literals to 0t123.


Raymond


More information about the Python-3000 mailing list