[Python-ideas] Left division operator
sturla at molden.no
Sun Jul 17 19:05:46 CEST 2011
Den 17.07.2011 18:27, skrev Steven D'Aprano:
> tmp = denominator() # Evaluate this first, because it has side-effects.
> result = numerator()/tmp
The order of the arguments is lost to the division operator.
> you can write this:
> result = denominator()\numerator()
Only for real numbers.
result = denominator()\numerator()
would be equivalent to
tmp = 1/denominator()
result = tmp * numerator()
But please ignore this suggestion, I agree that it is a bad suggestion.
There is a better solution for this particular problem, which is to make
1/x return a new type, so that (1/x)*y evalutes differenty from y*(1/x).
So I am thinking of suggesting addition of an "inverted matrix" type to
More information about the Python-ideas