[Twisted-Python] Ways to register stuff only done for backwards compatibility
James Y Knight
foom at fuhm.net
Wed Jul 6 08:48:43 MDT 2011
On Jul 5, 2011, at 8:32 AM, Laurens Van Houtven wrote:
> In doing twisted.positioning I find my self writing a bunch of code in ways I would ordinarily write it differently, because we have to support 2.4 still (when is that going away? Isn't the most recent RHEL 2.6 already?).
> Is there some way to register that so that as soon as we stop supporting 2.4, we can make a lot of code a lot prettier? For certain functions such as any/all, perhaps a twisted.python._backports (with the explicit mention that code in backports will go away as soon as the version it's built to work around is no longer supported). That way, as soon as you support 2.5 (which has any/all), you just remove it from _backports, see which tests break, remove the imports, run tests again, commit. Woo!
> Of course, _backports is obviously not a solution for everything, since not every language feature can be fixed by defining a class or a function somewhere.
Yes, we've done that many times before, in twisted.python.compat. (that should probably be an _ module now; it has always been treated as such, but it's not named appropriately.)
More information about the Twisted-Python