On Mon, 22 Aug 2016 10:52 pm, Random832 wrote: > On Mon, Aug 22, 2016, at 08:44, Chris Angelico wrote: >> However, I don't think it's particularly necessary. Explicit version >> number checks should be very rare, and shouldn't be encouraged. >> Instead, encourage feature checks, as Steve gave some examples of. > > The problem is when you want to write a large body of code that just > *uses* lots of features (including syntactic features), *without* > checking for them. Steve's examples were of how to support earlier > versions, not how *not* to. At some point you want to just write Python > 3 code and say to hell with Python 2, or the same for any particular > version of Python 3.
Surely that's not a problem -- it's what people have been doing with Python code for decades. When was the last time you saw somebody do an explicit version check? if sys.version_info() < (2, 2): raise RuntimeError('Python too old') Rather, you just use the features you rely on, document the minimum supported version, and if somebody is silly enough to try running your code under Python 1.4, they'll get a SyntaxError or an exception when you try to do something that is not supported. Maybe if Python supported this from the beginning it would be worth the bother. But it seems of very marginal utility to me. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list