#13586: BuiltinFunction expects to be instantiated only once
-------------------------------------+--------------------------------------
       Reporter:  burcin             |         Owner:  burcin             
           Type:  defect             |        Status:  positive_review    
       Priority:  major              |     Milestone:  sage-5.5           
      Component:  symbolics          |    Resolution:                     
       Keywords:  symbolic function  |   Work issues:                     
Report Upstream:  N/A                |     Reviewers:  Karl-Dieter Crisman
        Authors:  Burcin Erocal      |     Merged in:                     
   Dependencies:                     |      Stopgaps:                     
-------------------------------------+--------------------------------------

Comment (by burcin):

 Thanks for the quick review.

 Replying to [comment:2 kcrisman]:

 > Similarly, is this (new behavior, I think) ok?  I think so, but just
 want to make sure.
 > {{{
 > sage: class MyFunction(BuiltinFunction):
 > ....:     def __init__(self,name):
 > ....:         self.exponent=1
 > ....:         BuiltinFunction.__init__(self,name,nargs=1)
 > ....:     def _eval_(self,arg):
 > ....:         return arg**self.exponent
 > ....:
 > sage: MyFunction('p')
 > p
 > sage: p = MyFunction('p')
 > sage: p
 > p
 > sage: p(2)
 > 2
 > sage: p(3)
 > 3
 > sage: q = MyFunction('q')
 > sage: q(3)
 > 3
 > sage: p
 > p
 > sage: q
 > q
 > }}}

 I think this is how it used to work without the patch as well. But I admit
 that I don't understand your question. Are you surprised that `q` prints
 as `q` not `p`? We always use the user supplied name when printing the
 instance object. It's a different matter for the `self` argument you have
 inside the `_eval_()` function.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13586#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to