On 11/7/11 3:05 PM, kcrisman wrote:
On Nov 7, 3:00 pm, William Stein<wst...@gmail.com> 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/IPytho
n/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.
Even though not agreed, I recognize my opinion is in the minority, and
so I've been teaching people to avoid it for at least two years in
seminars/workshops.
But because of that experience, I have a recommendation.
If you open a ticket (or find one) for this, I think that we should
definitely put some easy-to-find documentation (maybe in the top-level
calculus and symbolics pages) that shows how to change "bad old" code,
especially in certain plotting situations, to the "new good" code
style. As well as some nice examples saying, "Until [2011,2012] we
used this, but it no longer works" (with doctest).
This is one of those places where having the automatic testing of
sagenb-type worksheets would be really helpful, because it would
uncover the most typical (ab)use cases. My guess is there are still
people using old ones. For instance, I hadn't taught a particular
course in two years, and discovered lots of them in my plot interacts
- where you need to say
@interact
def _(f=x^2)
g(x) = f
plot(g)
and that is a little weird, but
plot(f)
I think causes this error. (? if I recall correctly - it was
something along these lines but I don't remember for sure)
f=x^2
plot(f)
seems to work fine, with no deprecation warnings. I believe there is
some special-case code in plot for variables of one function already
(which really means that there is some special-case code in
fast_callable or fast_float for single-variable plots).
I still think the user should explicitly specify the variable, though, like:
plot(f,x)
or
plot(f,(x,0,1))
That is clearer and more pythonic (explicit better than implicit, etc.)
Thanks,
Jason
--
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