#14743: SymbolicFunction gives errors when using unbounded methods
-------------------------------------+--------------------------------------
Reporter: nvcleemp | Owner: burcin
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.11
Component: symbolics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Nico Van Cleemput | Merged in:
Dependencies: | Stopgaps:
-------------------------------------+--------------------------------------
Changes (by burcin):
* status: needs_review => needs_work
Comment:
Can you give an example of where this would be useful? Are you trying to
construct symbolic functions where the custom methods are compiled (hence
have no `func_code` attribute)?
This patch causes problems in the way we detect if a new symbolic function
is being created:
{{{
sage: f = function('f', evalf_func=Graph.wiener_index)
sage: f(5)
f(5)
sage: f(5).n()
TypeError: unbound method wiener_index() must be called with Graph
instance as first argument (got ComplexNumber instance instead)
sage: f = function('f', evalf_func=Expression.is_one)
sage: f(5).n()
TypeError: unbound method wiener_index() must be called with Graph
instance as first argument (got ComplexNumber instance instead)
}}}
Note that the second error message still refers to `wiener_index()`.
The documentation for `SymbolicFunction` states:
{{{
This is the basis for user defined symbolic functions. We try to
pickle or
hash the custom methods, so subclasses must be defined in Python not
Cython.
}}}
So using compiled (Cython) methods for the custom evaluation methods is
not supported. If you describe your application we can think about a
different solution.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14743#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.