[Python-Dev] Why is nb_inplace_power ternary?

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 10 13:42:37 CET 2007


Jim Jewett schrieb:
> Either
> 
> x**= n % 10             # The **= changes the parse context, so that %
> is no longer
>                                 # immediately evaluated

Are you seriously proposing such a change? I was asking for
spellings that currently don't have a meaning (rather, I was
suggesting that no such spelling exists, and the entire idea
of supporting such notation in the language is ridiculous).

> x**= (n, 10)              # exponentiation to a tuple isn't currently
> defined, and it

Likewise: it currenly is well-defined: it invoked nb_inplace_power
with the tuple (and __ipow__ if x's class is written in Python).
Whether this gives a TypeError or not depends on the class of x.

Regards,
Martin



More information about the Python-Dev mailing list