> > Speaking about deprecation, I posted a patch #7515 which does two things:
> >
> > 1 - Add an option called ``version`` do deprecation where you can put the
> > information on since which version of sage this thing was deprecated:
> >
> >        sage: def bar():
> >        ...    sage.misc.misc.deprecation("The function bar is removed.",
> >        ...         'Sage Version 4.2, Release Date: 2009-10-24')
> >        sage: bar()
> >        doctest:...: DeprecationWarning: (Since Sage Version 4.2, Release 
> > Date: 2009-10-24) The function bar is removed.
> >
> > Note: This does noting than gluing the two strings, but this prompt the 
> > writer
> > of the function to insert this information at the right place. For backward
> > compatibility, This is only optional.
> 
> That's a good idea, and will make it easier to remove deprecated code
> after a given time limit.

That was the idea, as well as to push the user to update their code...

> >
> > 2 - When renaming a function or method, you can use 
> > deprecated_function_alias
> > or deprecated_method_alias to keep the function under the old name:
> >
> >        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
> >
> > I thinks both idea might be helpful. Anyone against this design ? Or any
> > better idea ? In particular, if someone has a better name for
> > deprecated_method_alias and deprecated_function_alias (actually both are the
> > same)...
> 
> I prefer  deprecated_function_alias if it also works on methods.

Done and re-updated. Waiting for review on #7515

Cheers,

Florent

-- 
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

Reply via email to