Hi!

The most straight forward way does not work:

sage: def bla(x):
....:     print "here I am"
....:     return x**2
....:
sage: foo = function("foo", nargs=1, eval_func = bla)
sage: foo(5)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)

/home/king/<ipython console> in <module>()

/mnt/local/king/SAGE/broken/local/lib/python2.6/site-packages/sage/
symbolic/function.so in sage.symbolic.function.Function.__call__ (sage/
symbolic/function.cpp:4450)()

TypeError: bla() takes exactly 1 argument (2 given)

The problem is that foo passes "self" as first argument.

Is there a way to suppress passing self as an argument?

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to