Using non-ascii symbols
Claudio Grondi
claudio.grondi at freenet.de
Thu Jan 26 11:47:51 EST 2006
Rocco Moretti wrote:
> Terry Hancock wrote:
>
>> One thing that I also think would be good is to open up the
>> operator set for Python. Right now you can overload the
>> existing operators, but you can't easily define new ones.
>> And even if you do, you are very limited in what you can
>> use, and understandability suffers.
>
>
> One of the issues that would need to be dealt with in allowing new
> operators to be defined is how to work out precedence rules for the new
> operators. Right now you can redefine the meaning of addition and
> multiplication, but you can't change the order of operations. (Witness
> %, and that it must have the same precedence in both multiplication and
> string replacement.)
>
> If you allow (semi)arbitrary characters to be used as operators, some
> scheme must be chosen for assigning a place in the precedence hierarchy.
Speaking maybe only for myself:
I don't like implicit rules, so I don't like also any precedence
hierarchy being in action, so for safety reasons I always write even
8+6*2 (==20) as 8+(6*2) to be sure all will go the way I expect it.
Claudio
More information about the Python-list
mailing list