#11585: Make deprecated_function_alias print the whole module path when it
differs
from the original
---------------------------+------------------------------------------------
Reporter: defeo | Owner: jason
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-4.7.2
Component: misc | Keywords: deprecation
Work_issues: | Upstream: N/A
Reviewer: Rob Beezer | Author: Luca De Feo
Merged: | Dependencies:
---------------------------+------------------------------------------------
Changes (by rbeezer):
* cc: hivert (added)
* reviewer: => Rob Beezer
* status: needs_review => needs_work
Old description:
> Currently
>
> {{{
> sage: from sage.misc.misc import deprecated_function_alias
> sage: a = deprecated_function_alias(sqrt, "Version ?")
> sage: a(5)
> ...
> DeprecationWarning: (Since Version ?) a is deprecated. Please use sqrt
> instead.
> sqrt(5)
> }}}
>
> which is misleading because the user would expect to find `sqrt` in the
> same module as `a`.
>
> With this patch
>
> {{{
> sage: from sage.misc.misc import deprecated_function_alias
> sage: a = deprecated_function_alias(sqrt, "Version ?")
> sage: a(5)
> ...
> DeprecationWarning: (Since Version ?) a is deprecated. Please use
> sage.functions.other.sqrt instead.
> sqrt(5)
> }}}
>
> There's no change in deprecating methods.
New description:
Currently
{{{
sage: from sage.misc.misc import deprecated_function_alias
sage: a = deprecated_function_alias(sqrt, "Version ?")
sage: a(5)
...
DeprecationWarning: (Since Version ?) a is deprecated. Please use sqrt
instead.
sqrt(5)
}}}
'''Apply:'''
1. [attachment:trac_11585_depracted_function_alias.patch]
which is misleading because the user would expect to find `sqrt` in the
same module as `a`.
With this patch
{{{
sage: from sage.misc.misc import deprecated_function_alias
sage: a = deprecated_function_alias(sqrt, "Version ?")
sage: a(5)
...
DeprecationWarning: (Since Version ?) a is deprecated. Please use
sage.functions.other.sqrt instead.
sqrt(5)
}}}
There's no change in deprecating methods.
--
Comment:
Looks good. Passes long tests on 4.7.1.alpha3. I've cc'ed Florent Hivert
in case he wants to add anything. I've also added an "Apply" section to
the description for the release manager.
Two minor formatting items need attention.
Line 2287: {{{Trac #11585::}}}
You need a blank line after the double-colon to make the verbatim text
format properly.
You can test documentation via {{{sage -docbuild reference html}}} after
a fresh build ({{{sage -b}}}) and then viewing the resulting HTML file.
Line 2299:
{{{
if module is None: module_name = '__main__'
else: module_name = module.__name__
}}}
should be formatted as
{{{
if module is None:
module_name = '__main__'
else:
module_name = module.__name__
}}}
See http://www.sagemath.org/doc/developer/conventions.html
which references: http://www.python.org/dev/peps/pep-0008/
(look shortly after "Compound statements")
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11585#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.