Message193175
This is expected. When you assign to "n.__div__" a function which takes two parameters, you have to call it with two parameters:
aFunction = lambda x, y: (x, y)
n.__div__ = aFunction
aFunction(1, 2)
n.__div__(1, 2)
After all, aFunction and n.__div__ are the same object.
Now, it would be different if you had attached the function to the *class* instead:
n.__class__.__div__ = aFunction
n.__div__(2) # returns (n, 2)
In this second example, n.__div__ is a bound method; the first parameter (usually named "self") is already filled, and only the second one is required. |
|
Date |
User |
Action |
Args |
2013-07-16 15:00:17 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, brett.cannon, eric.smith, James.Lu |
2013-07-16 15:00:17 | amaury.forgeotdarc | set | messageid: <1373986817.09.0.207274727443.issue18474@psf.upfronthosting.co.za> |
2013-07-16 15:00:17 | amaury.forgeotdarc | link | issue18474 messages |
2013-07-16 15:00:16 | amaury.forgeotdarc | create | |
|