[Distutils] Are chained comparisons allowed in environment markers?

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Apr 27 11:46:59 CEST 2013


PJ Eby <pje <at> telecommunity.com> writes:

> I notice that distlib appears to support chaining of comparisons, but
> the PEP does not.  ISTM that there is no sane use case for chaining,
> given the nature of comparisons that are allowed.  (That is, if you
> perform one equality or contains comparison between two values, then
> you know how the next comparison would turn out.)
> 
> If chained comparisons are disallowed in the PEP, then distlib
> probably shouldn't be allowing them either, to prevent interop issues
> w/tools that only support what's in the PEP.

Sorry if I'm being dense, but can you confirm that what you mean by
"chaining" is something like "a < b <= c"?
 
Things can be tightened up once PEP 426 is finalised. At the moment, distlib
allows expressions like "python_version >= '2.6'" or "python_version < '3.5'"
which are also not mentioned in the PEP. I don't recall seeing any discussion
around why allowing inequalities might be a bad idea, but perhaps someone
can point me to it? Perhaps it should be mentioned in the PEP.

Regards,

Vinay Sajip





More information about the Distutils-SIG mailing list