#7515: Improved deprecation and renaming of function and methods.
---------------------------+------------------------------------------------
Reporter: hivert | Owner: hivert
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.3
Component: misc | Keywords: deprecation:
Work_issues: | Author: Florent Hivert
Upstream: N/A | Reviewer:
Merged: |
---------------------------+------------------------------------------------
Along the cleanup of combinat, a lot of methods and function get renamed.
It is painfull to write backward compatibility aliases.
The patch given here should make it easier. I take also the chance to add
a version optional argument to {{{deprecation}}} to store and print in
which version of sage the method/function was deprecated.
Here is an excerpt from the doc:
{{{
sage: from sage.misc.misc import deprecated_function_alias
sage: g = deprecated_function_alias(number_of_partitions,
... 'Sage Version 42.132, Release Date: 5123-04-01')
sage: g(5)
doctest:1: DeprecationWarning: (Since Sage Version 42.132, Release
Date: 5123-04-01) g is deprecated. Please use number_of_partitions
instead.
7
}}}
This also works for methods:
{{{
sage: from sage.misc.misc import deprecated_method_alias
sage: class cls(object):
... def new_meth(self): return 42
... old_meth = deprecated_method_alias(new_meth,
... 'Sage Version 42.132, Release Date: 5123-04-01')
sage: cls().old_meth()
doctest:...: DeprecationWarning: (Since Sage Version 42.132,
Release Date: 5123-04-01) old_meth is deprecated. Please use new_meth
instead.
42
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7515>
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=.