--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
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).
Thanks,
Jason
I encourage somebody to add it!
Here's the raw html, if that is helpful:
http://wstein.org/edu/2010/581d/notes/2010-11-01.html
William
>
> I have one comment: In the current version, sage.misc.misc.deprecation
> has some steep limitations. Trac #9919 (along with #9907) fixes it so
> it can be used on non-function callables (e.g. methods). Trac #9907
> moves it to sage.misc.decorators.deprecation. Trac #9976 patches
> Sphinx so decorated callables in general will not have their signature
> reduced to a generic one in the documentation. These tracs depend on
> each other in that order and they all need review (hint hint).
> Especially the relocation of the decorator should perhaps be kept in
> mind for the blog entry.
>
> Cheers, Johan
>
> On Nov 1, 11:30 am, Jason Grout <jason-s...@creativetrax.com> wrote:
>> On 11/1/10 12:23 AM, William Stein wrote:
>>
>> >http://sagemath.blogspot.com/2010/10/how-to-referee-sage-trac-tickets...
>>
>> 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).
>>
>> Thanks,
>>
>> Jason
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
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