I've been thinking more about how to handle deprecated functionality. 
See 
http://groups.google.com/group/sage-devel/browse_thread/thread/1e7d8b8880211b80/34e374ed36977b31
 
for our initial discussion.  There, the conclusions seemed to be:

1. We should have a DEPRECATED section of the docstring in which 
deprecated notes should be listed.  Optionally, we could go through 
sections like these before a major release and remove functions, etc.

2. Throw a DeprecatedError when some piece of functionality is used. 
The reasoning here is that people would know very quickly what code was bad.


I like #1.  #2, however, seems to go too far.  "Deprecated" means that 
things don't break just yet, they just warn you that you're on risky 
ground for the future and that you'd better change your code.  Throwing 
an error aborts everything instead.

Thankfully, Python already has a framework for deprecation (imagine 
that!).  See http://docs.python.org/lib/module-warnings.html.  This 
module creates a framework for warning the user of all sorts of things 
(not just deprecated functionality).  The user can configure python to 
turn these warnings into exceptions, print them to the console, ignore 
them, etc.

Does anyone have experience using the warning module, specifically with 
regards to the DeprecationWarning and PendingDeprecationWarning?

Note that there are other warnings in Sage that could use the warning 
module, like the warning about bad points in plotting, etc.

Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to