[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: 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 an

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Eric V. Smith
Eric V. Smith added the comment: Could you provide an entire example, showing the class num and how you assign __div__? -- nosy: +eric.smith ___ Python tracker ___ _

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu
James Lu added the comment: Also,there were some bugs, but after I fixed them, it would only work if I did this: n.__div__(n,3) -- ___ Python tracker ___ ___

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu
James Lu added the comment: instance,assinged during __init__ -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu
James Lu added the comment: 2.5,new-style -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Brett Cannon
Brett Cannon added the comment: What version of Python is this and did you assign the lambda to an instance or class (and if this is Python 2, new-style or classic class)? -- nosy: +brett.cannon ___ Python tracker

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu
Changes by James Lu : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu
New submission from James Lu: if you assign a lambda to a object and call it,you get this: Traceback (most recent call last): File "", line 1, in n.__div__(3) TypeError: () takes exactly 2 arguments (1 given) The full test is here: >>> n = num() >>> n.__div__ at 0x040B2DF0> >>> n/3 Traceb