On 11/07/2011 03:00 PM, William Stein wrote:
> Hi,
> 
> Twice in the last day I've hit this deprecation warning due to making
> a stupid typo:
> 
> sage: d(N) = (1/2)*(N^2-1)(N^2-N)/(N-1)       # contains stupid typo
> /Users/wstein/sage/install/current/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
> 
> I've been trying to get rid of this mistake in symbolic calculus since
> probably 2007.   I say we get rid of it soon, e.g., in sage-4.8 (or
> certainly in sage-5.0).  It's time for it to go.
> 

There's a potential problem with piecewise:

  $ ./iterated-2d-solution.py
  ./iterated-2d-solution.py:85: 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=...)
    s_a = this_s(terminal)

"this_s" is a piecewise function of x:

  Piecewise defined function with 1 parts, [[(0, 0.500000000000000),
  4.00000000000000*(x - 0.500000000000000)^2 - 10.1278345910970*(x -
  0.500000000000000)*x + 5.78826325138787*x^2]]

But if you name it explicitly,

  TypeError: __call__() got an unexpected keyword argument 'x'


Here's another, where it seems to be complaining about a *python* function:

  ./w3-double_cubic.py:86: 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=...)
    p2 = please_substitute_function(2, domain_points, p2, f, cos(x))

This is defined in another file:

  def please_substitute_function(max_degree,
                                 points,
                                 expr,
                                 func1,
                                 func2):
  ...


Even if I change the call to it in w3-double_cubic.py, I get the same error:

  ./w3-double_cubic.py:85: 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=...)
    p1 = please_substitute_function(max_degree=2,
                                    points=domain_points,
                                    expr=p1,
                                    func1=f,
                                    func2=cos(x))


So please don't trade the warning for an error unless you're sure that
there aren't any false positives (i.e. I'm doing something wrong).

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to