[Twisted-Python] Ways to register stuff only done for backwards compatibility

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Jul 5 07:34:26 MDT 2011

On 12:32 pm, _ at lvh.cc wrote:
>In doing twisted.positioning I find my self writing a bunch of code in 
>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 
>Is there some way to register that so that as soon as we stop 
>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 
>code in backports will go away as soon as the version it's built to 
>around is no longer supported). That way, as soon as you support 2.5 
>has any/all), you just remove it from _backports, see which tests 
>remove the imports, run tests again, commit. Woo!
>Of course, _backports is obviously not a solution for everything, since 
>every language feature can be fixed by defining a class or a function

Previously we've added things like this - socket.inet_pton, set, even 
dict long, long ago - to twisted.python.compat, which sounds similar to 
the _backports module you suggest.

I didn't think of the addition of such things to a module as 
"registration" or I would have mentioned this when you asked before on 
IRC. :)


More information about the Twisted-Python mailing list