#17547: BuiltinFunction overriding GiNaC function is allowed
-------------------------+----------------------------
   Reporter:  rws        |            Owner:
       Type:  defect     |           Status:  new
   Priority:  major      |        Milestone:  sage-6.5
  Component:  symbolics  |         Keywords:
  Merged in:             |          Authors:
  Reviewers:             |  Report Upstream:  N/A
Work issues:             |           Branch:
     Commit:             |     Dependencies:
   Stopgaps:             |
-------------------------+----------------------------
 {{{
 sage: from sage.symbolic.function import BuiltinFunction
 sage: class AFunction(BuiltinFunction):
 ....:       def __init__(self, name, exp=1):
 ....:           self.exponent=exp
 ....:           BuiltinFunction.__init__(self, name, nargs=1)
 ....:       def _eval_(self, arg):
 ....:               return arg**self.exponent
 sage: p2 = AFunction('exp', 2)
 sage: p2(x)
 e^x
 sage: _.function()
 () |--> e^x
 }}}
 The attempt at creation should give an error (plus respective
 documentation warnings).

 Alternatively, search first for user-defined function names, then GiNaC
 core, to allow overriding.

--
Ticket URL: <http://trac.sagemath.org/ticket/17547>
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/d/optout.

Reply via email to