Hi there,
On Mon, Nov 01, 2010 at 05:30:55AM -0500, Jason Grout wrote:
> On 11/1/10 12:23 AM, William Stein wrote:
> >http://sagemath.blogspot.com/2010/10/how-to-referee-sage-trac-tickets.html
> >
>
>
> Nice. I'll have more comments later, but I did notice that this:
>
> from sage.misc.misc import deprecation
> deprecation("function_name is deprecated, using new_function_name instead!")
>
>
> came out in formatting wrong (the second line looks like this in my
> firefox (3.6.12, osx snow leopard):
>
> deprecation("function_name is deprecated, using new
>
> Also, you may want to put in the Sage version number to give people
> a clue about when to remove the function (see the second argument to
> deprecation).
Actually there is a more handy tools for this precise purpose namely
deprecated_function_alias:
sage: from sage.misc.misc import deprecated_function_alias
sage: g = deprecated_function_alias(number_of_partitions,
... 'Sage Version 42.132')
sage: g(5)
doctest:...: DeprecationWarning: (Since Sage Version 42.132) g is
deprecated. Please use number_of_partitions instead.
7
This also works for methods::
sage: class cls(object):
... def new_meth(self): return 42
... old_meth = deprecated_function_alias(new_meth,
... 'Sage Version 42.132')
sage: cls().old_meth()
doctest:...: DeprecationWarning: (Since Sage Version 42.132) old_meth
is deprecated. Please use new_meth instead.
42
Cheers,
Florent
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org