Opened 9 years ago

Last modified 7 years ago

#12817 new defect

The 'nargs' argument to function() is undocumented

Reported by: mjo Owned by: mvngu
Priority: major Milestone: sage-6.4
Component: documentation Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


This could potentially be useful, but the docs only mention the following inputs:

  • Variable name(s)
  • latex_name
  • print_latex_func
sage: x,y = var('x,y')          
sage: f = function('f', nargs=1)
sage: f(x,y)
TypeError                                 Traceback (most recent call last)

/home/mjo/src/sage-5.0.beta12/devel/sage-main/<ipython console> in <module>()

/home/mjo/src/sage-5.0.beta12/local/lib/python2.7/site-packages/sage/symbolic/ in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3674)()

TypeError: Symbolic function f takes exactly 1 arguments (2 given)

Change History (5)

comment:1 Changed 9 years ago by nbruin

Note that sage.calculus.var.var and sage.calculus.var.function are just convenience wrappers of SR.var and sage.symbolic.function_factory.function_factory respectively. Both are augmented to inject the name they define into the global namespace and are therefore only suited for interactive use at sage's toplevel. In any more elaborate program or in library code, you should use the original functions.

The documentation of any of those can use improvement, but I'm not sure you want to explain all options in all of their docstrings. Perhaps a good cross reference can save some work.

comment:2 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.