[Python-Dev] Why is nb_inplace_power ternary? (original) (raw)
Jim Jewett jimjjewett at gmail.com
Fri Feb 9 16:42:22 CET 2007
- Previous message: [Python-Dev] Adding timeout option to httplib...connect()
- Next message: [Python-Dev] Why is nb_inplace_power ternary?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing schrieb:
Might we want to add an in-place version of the 3-arg pow() function one day? If so, leaving the third argument there could be useful.
"Martin v. Löwis" martin at v.loewis.de replied:
What could the syntax for that be?
Instead of writing
x = pow(x, n, 10)
Either
x**= n % 10 # The **= changes the parse context, so that % is no longer # immediately evaluated or
x**= (n, 10) # exponentiation to a tuple isn't currently defined, and it # does show that both arguments are part of the power # expression -- but I'm not sure it needs a 3-argument form # instead of just unpacking the tuple itself.
-jJ
- Previous message: [Python-Dev] Adding timeout option to httplib...connect()
- Next message: [Python-Dev] Why is nb_inplace_power ternary?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]