#12070: Unavoidable DeprecationWarnings when calling piecewise functions
-----------------------------+------------------------
       Reporter:  mjo        |        Owner:  burcin
           Type:  defect     |       Status:  new
       Priority:  minor      |    Milestone:  sage-6.4
      Component:  symbolics  |   Resolution:
       Keywords:             |    Merged in:
        Authors:             |    Reviewers:
Report Upstream:  N/A        |  Work issues:
         Branch:             |       Commit:
   Dependencies:             |     Stopgaps:
-----------------------------+------------------------

Comment (by mjo):

 Replying to [comment:10 nbruin]:
 > The example in this ticket is just misuse. `piecewise` takes functions,
 not expressions.

 Ok, but the existing doctests and examples (mis)use that same format (I
 never knew I could/should change an expression into a function). The ones
 that don't, rely on the preparsing of `f(x) = ...` that isn't helpful to
 people using `piecewise()` in python code. What do we do with `f(x) = 1`,
 change it to `f = SR(1).function(x)`?

 I think `f = SR(1).function(x)` is stupid, but having examples that only
 work when preparsed isn't great either. How about we just fix this for
 symbolic expressions of one variable?

 {{{
 if is_Expression(f):
     if len(f.variables()) == 1:
         f = f.function(f.variables()[0]) # We know what you meant bro.
     else:
         raise Whatever()
 }}}

 If there's a good reason not to do that, then the examples illustrating
 e.g. `(x**2).function(x)` should at least be prominent.

--
Ticket URL: <http://trac.sagemath.org/ticket/12070#comment:13>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to