On 3/14/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [GvR] > >I agree with Thomas that allowing the literal 0012 in a program to > >return the value 10 would trip up old-timers too easily. > > Did you mean "return the value 12 when 10 was intended"?
Yes, sorry. > My worry focuses on new-timers and SyntaxErrors. The worst part of the new > user experience is encountering a SyntaxError. Because of the way we > generate them, invalid syntax errors are not very informative and it is not > always self-evident how to fix them. I don't think we're helping the > language by adding a new special rule (lead zeros are okay on floats and > decimals but not ints) that results in a new source of SyntaxErrors. Then let's focus on improving the error message. > IMO, Py3.0 would be cleaner with 0012 being 12 and not raising a SyntaxError. While I would agree in an ideal world, I find Thomas's argument compelling. Not all newbie Python users are first-time computer users; if they have C/C++ or other Unixoid languages under their belt (even Java has leading-zero-as-octal!) they might type 0600 and never notice it returns the wrong value until it's too late. Swapping the confusion of one group for the confusion of another group is not quite worth it. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
