How do I call the double() function?

grocery_stocker cdalten at gmail.com
Sat Mar 21 15:55:20 CET 2009


Given the following....

def double(val):
    return val.bind(lambda x: val.return_(x*2))


I get "AttributeError: 'int' object has no attribute 'bind' " when I
try to do the following

double(2)

Below is the output...

[cdalten at localhost ~]$ python
Python 2.4.3 (#1, Oct  1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def double(val):
...     return val.bind(lambda x: val.return_(x*2))
...
>>> double(2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 2, in double
AttributeError: 'int' object has no attribute 'bind'
>>>



More information about the Python-list mailing list