Guido van Rossum firstname.lastname@example.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").