[Python-Dev] Octal literals

2006-01-31 Thread mattheww
Guido van Rossum  <[EMAIL PROTECTED]> wrote:
>Right. And this is not a hypothetical issue either -- in Perl, hex and
>oct *do* work the other way I believe. More reasons to get rid of
>these in Python 3000. Perhaps we should also get rid of hex/oct
>lterals?


I would like to argue for removing octal literals.

This feature has a very bad property: it can cause obscure problems for
people who do not know or care about it. I have seen people try to use
leading zeroes to make integer literals line up in a table. If they are
lucky, they will get a syntax error. If they are unlucky, their program
will silently do the wrong thing.

It would be rather offputting to have to warn about this in the
tutorial. But at present, a learner who isn't familiar with another
language using this convention would have no reason to suspect it
exists. As far as I can tell, it's documented only in the BNF.

I think the safe thing in Python 3000 would be for literals with leading
0 to be syntax errors.

Possibly os.chmod and os.umask could be extended to take a string
argument so we could write chmod(path, "0640").

-M-

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Octal literals

2006-01-31 Thread mattheww
Andrew Koenig <[EMAIL PROTECTED]> wrote:
>> Possibly os.chmod and os.umask could be extended to take a string
>> argument so we could write chmod(path, "0640").
>
>-1.
>
>Would you really want chmod(path, 0640) and chmod(path, "0640") to have
>different meanings?


I want the former to be a syntax error, as I said in the preceding paragraph.

-M-

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com