On 2/12/2010 4:40 AM, Jussi Piitulainen wrote:
Terry Reedy writes:
On 2/11/2010 11:23 AM, Jussi Piitulainen wrote:
Robert Kern writes:
On 2010-02-11 06:31 AM, Shashwat Anand wrote:
There is a little issue here that '>>> -.1 ** .1' should give you
error message. That is it.
No, fractional powers of negative numbers are perfectly valid
mathematically. The result is a complex number. In Python 3 (what
the OP is using), this has been implemented, but not in Python 2.6.
Perhaps it should raise a MisleadingSpacingError at compile time.
You forgot the smiley ;-).
> The error message could recommend - .1**.1, or better -(.1 ** .1).
The compiler would never see the difference between -.1 ** .1 and the
first and probably no difference with the second either.
It could be done the same way that the compiler keeps track of the
source line numbers now: early phases annotate their output with any
information that later phases may need. This error would be detected
during syntactic analysis.
There is no error to detect. Sorry, read the manual and either learn or
lookup precedence rules (there is a table in the end of the Expressions
chapter) or use parentheses when not sure.
--
http://mail.python.org/mailman/listinfo/python-list