A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-January/060262.html below:

[Python-Dev] Octal literals

[Python-Dev] Octal literalsmattheww at chiark.greenend.org.uk mattheww at chiark.greenend.org.uk
Tue Jan 31 20:46:39 CET 2006
Guido van Rossum  <guido at python.org> 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-

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4