[Distutils] Are chained comparisons allowed in environment markers?

PJ Eby pje at telecommunity.com
Sat Apr 27 16:47:59 CEST 2013


On Sat, Apr 27, 2013 at 5:46 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Sorry if I'm being dense, but can you confirm that what you mean by
> "chaining" is something like "a < b <= c"?

Yes.


> Things can be tightened up once PEP 426 is finalised.

Not if anybody's going to be using distlib between now and then,
unless you want to break backwards compatibility.  Perhaps distlib is
sufficiently experimental at the moment for this not to be a problem,
but since I'm implementing this in setuptools, backwards compatibility
will be an issue from the moment I release it.  ;-)

> 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.

I don't know of any reasons myself.  Perhaps it was thought that
restricting the syntax would make it easier to implement?  For Python,
that's not especially true.

The marker syntax has some other annoying quirks that make it more
difficult to implement and weird to spell, anyway, like mixing actual
things ('sys.platform') with non-real things (e.g. 'platform.machine'
that's really 'platform.machine()').  It would make a lot more sense
(and simplify implementations) to just say 'platform_machine' or even
'machine' in the first place.

OTOH, I hope that we can finalize at least the environment marker
syntax pronto, so I don't end up with a dead-end version of the
syntax.


More information about the Distutils-SIG mailing list