[Python-Dev] Why is nb_inplace_power ternary? (original) (raw)
Brett Cannon brett at python.org
Fri Feb 9 19:27:51 CET 2007
- Previous message: [Python-Dev] Why is nb_inplace_power ternary?
- Next message: [Python-Dev] Why is nb_inplace_power ternary?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/9/07, "Martin v. Löwis" <Martin.vonLoewis at hpi.uni-potsdam.de> wrote:
Brett Cannon schrieb: > Seems reasonable to me. Is the argument of None passed in > automatically somewhere?
There are few callers of nbinplacepower at all (AFAICT, only PyNumberInPlacePower); in turn, PyNumberInPlacePower is called with the implicit PyNone always: - ceval.c, for INPLACEPOWER (which is binary) - operator.ipow (which is also binary) - class.c, from bininplacepower, which in turn is called from instanceipow if the instance's 3rd argument to nbinplacepower is PyNone (if there is a non-None third argument, instanceipow invokes ipow with three arguments if ipow is defined, else it invokes pow with three arguments) The only case I could find where a third argument is non-None is when the builtin pow() is invoked, which then invokes nbpower (but not nbinplacepower) with three arguments.
Well then explicitly ignoring the object makes sense to me. While I am personally fine with raising the exception, erring on the side of caution as Raymond is suggesting wouldn't hurt either.
-Brett
- Previous message: [Python-Dev] Why is nb_inplace_power ternary?
- Next message: [Python-Dev] Why is nb_inplace_power ternary?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]