in-place exponentiation incongruities

Giacomo Alzetta giacomo.alzetta at gmail.com
Tue Aug 14 03:14:54 EDT 2012


Il giorno domenica 12 agosto 2012 23:53:46 UTC+2, Terry Reedy ha scritto:
> 
> Are you actually planning to do this, or is this purely theoretical?
> 

Yes, I do plan to implement ipow.

> 
> Not true. Whether the function is coded in Python or C
> 
> cls.__ipow__(base, exp, mod) # or
> 
> base.__ipow__(exp, mod)
> 
> 
> 
> > while he would be able to
> 
> > call the normal version with the third argument.

Yes, that's true. But I find that calling a special-method in that way is *really* ugly. I'd think that the pow built-in function was probably inserted to avoid writing base.__pow__(exp, mod).





More information about the Python-list mailing list