Skip to content

Symbolic arguments() method #9126

@jasongrout

Description

@jasongrout

Right now, the following works:

sage: a=(x+y)
sage: a.arguments()
(x, y)

However, we deprecated the following a long time ago:

sage: a(1,2)
/Users/grout/sage/local/lib/python2.6/site-packages/IPython/iplib.py:2073:
DeprecationWarning: Substitution using function-call syntax and unnamed
arguments is deprecated and will be removed from a future release of
Sage; you can use named arguments instead, like EXPR(x=..., y=...)
   exec code_obj in self.user_global_ns, self.user_ns
3

I propose that a.arguments() should return a deprecation warning:

sage: a.arguments()
/Users/grout/sage/local/lib/python2.6/site-packages/IPython/iplib.py:2073:
DeprecationWarning: (Since Sage version 4.4.2) symbolic expressions do
not have default callable arguments.  Please use the variables() method
   exec code_obj in self.user_global_ns, self.user_ns
(x, y)

This will impact other things as well, since apparently things have been
using .arguments() when they should have been using .variables(). I can
post a patch for this. Here, I'm just calling for comment, especially
from those that think this will mess everything up in some way.

Note that callable functions will still have sensible return values:

sage: f(x,y)=x+y
sage: f.arguments()
(x, y) 

Component: symbolics

Reviewer: Michael Orlitzky

Issue created by migration from https://trac.sagemath.org/ticket/9126

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions