Proposal for quoted octal

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Thu Feb 14 13:47:30 EST 2002


On Wed, 13 Feb 2002 07:51:36 -0800, John W. Baxter <jwbaxter at spamcop.net> wrote:
>In article <mailman.1013611523.15053.python-list at python.org>, Simon
>Brunning <SBrunning at trisystems.co.uk> wrote:
>
>> Probably to late to do anything about it now - think of all the code which
>> would break!
>
>Did the elves at AT&T pick up the "leading 0 means octal" from
>something earlier, or did they invent this stupidity themselves?
>
>Either way, we're stuck with it.

Not necessarily stuck for ever.  How about the following plan in three steps?


				Proposal to change octal notation

1) allow \041 to mean what is today 041, ie 33.  It might be even better to
   use \O41 (the letter O).

2) from __future__ import backquote_octal so that 041 will mean 41.
   from __future__ import zerolead_octal so that 041 will mean 33.
   Otherwise octals produce a warning.

3) make backquote_octal mandatary.  

As long as steps 2 and 3 are far apart this will not cause much trouble.
This does not change the meaning of \041 in a string:

	 '\041' == '!';     \041 == 33;      041 == 41

Huaiyu



More information about the Python-list mailing list