parse-time optimizations
Greg Ewing
see at my.signature
Fri Jun 1 01:20:46 EDT 2001
jcm wrote:
>
> Another
> poster implied that in Python you can redefine plus so that it is
> right-associative for a custom type.
No, he said "not associative", meaning that
(a+b)+c is not necessarily equal to a+(b+c).
That's a different issue from whether an
operator is left- or right-associative, which
is a syntactic issue concerning how to interpret
a+b+c when there is no explicit grouping. In
that sense, the +-*/ operators are all left-
associative in Python (this is determined by
the Python grammar, and can't be changed).
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list