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 pyshell#21, line 1, in module
n.__div__(3)
TypeError: lambda() takes exactly 2 arguments (1 given)
The full test is here:
n = num()
n.__div__
function lambda
Changes by James Lu jam...@gmail.com:
--
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18474
___
___
Python-bugs-list mailing
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 rep...@bugs.python.org
James Lu added the comment:
2.5,new-style
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18474
___
___
Python-bugs-list mailing list
James Lu added the comment:
instance,assinged during __init__
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18474
___
___
Python-bugs-list
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 rep...@bugs.python.org
http://bugs.python.org/issue18474
___
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 rep...@bugs.python.org
http://bugs.python.org/issue18474
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 and