Re: [Python-Dev] @deprecated (was: Useful thread project for 2.5?)

2005-03-09 Thread Stephan Richter
On Tuesday 08 March 2005 18:05, Jim Jewett wrote:     ... compiler recognition of @deprecated in doc comments. Michael Chermside suggested:     = code =     import warnings     def deprecated(func):         This is a decorator which can be used to mark functions         as

Re: [Python-Dev] @deprecated (was: Useful thread project for 2.5?)

2005-03-09 Thread Guido van Rossum
This is a recipe for disaster. Creating a new function from the old can have unwanted side effects, since you effectively change the object. For example, if someone is monkey patching this function, then the deprecation warning gets lost. That's a rather extreme use case, and not one that IMO

[Python-Dev] @deprecated (was: Useful thread project for 2.5?)

2005-03-08 Thread Jim Jewett
Greg wished for: ... compiler recognition of @deprecated in doc comments. Michael Chermside suggested: = code = import warnings def deprecated(func): This is a decorator which can be used to mark functions as deprecated. It will result in a warning being

RE: [Python-Dev] @deprecated (was: Useful thread project for 2.5?)

2005-03-08 Thread Raymond Hettinger
Michael Chermside suggested: import warnings def deprecated(func): This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used. def newFunc(*args, **kwargs):