This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients James.Lu, amaury.forgeotdarc, brett.cannon, eric.smith
Date 2013-07-16.15:00:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373986817.09.0.207274727443.issue18474@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-07-16 15:00:17amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, brett.cannon, eric.smith, James.Lu
2013-07-16 15:00:17amaury.forgeotdarcsetmessageid: <1373986817.09.0.207274727443.issue18474@psf.upfronthosting.co.za>
2013-07-16 15:00:17amaury.forgeotdarclinkissue18474 messages
2013-07-16 15:00:16amaury.forgeotdarccreate