[Python-Dev] Deprecate sys.exitfunc? (original) (raw)

Guido van Rossum guido at python.org
Tue Aug 17 23:48:35 CEST 2004


On Tue, Aug 17, 2004 at 08:28:03AM -0700, Guido van Rossum wrote: > > Well, none, really. But let's not change the name sys.exitfunc just > > for the sake of deprecation, because it will probably break existing > > and well-behaving modules (not just non-well-behaving ones). > > That's never been a reason not to deprecate something.

Sorry. Sure. What I was opposing here is Raymond's original claim in this thread, which was apparently the reason he wanted to deprecate sys.exitfunc: """ The atexit module does attempt to co-exist by introducing code to register a function in sys.exitfunc if it were defined before "import atexit" was called. However, this is unreliable because it depends on import order and the library is free to introduce an earlier "import atexit" which would break code relying on the co-existance mechanism. """ I claim that there is nothing unreliable or depending on import order here, as long as all concerned parties do the right thing. Now if there are other good reasons to deprecate sys.exitfunc, like it being another way of doing something for which a better interface is provided, then fine.

Raymond may have overstated his case somewhat. But the fact is that it is easy to abuse sys.exitfunc with a poorly written handler, and the atexit module avoids this. This in itself to me looks like a classic "deprecate the old solution, recommend the new way". TOOWTDI!

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list