[Distutils] Environment marker expression types

PJ Eby pje at telecommunity.com
Fri Apr 26 02:12:17 CEST 2013


I was just fiddling with an experimental environment marker
implementation for setuptools, and ran across a bit of a quirk in the
spec.  It says that the value of 'extra' is 'None', but that
comparisons can only be done on strings.

This leads to two problems: first, the syntax doesn't have a way to
spell 'None', so you can't actually compare it to something.  Second,
if you compare it to a string using the equality operators, IIUC
you'll get a TypeError under Python 3.

Should it actually be defaulting 'extra' to an empty string?  That
would actually make a lot more sense, and avoid the issue of
implementing non-string comparisons, None literals, etc.

(Doing extras in this way actually has another problem, btw, which is
that it's insane to do a != comparison on an 'extra'.  And there are
probably other insane operations on extras, because unlike everything
else, the extra would need to be dynamically evaluated.  I think it
would probably be an improvement to remove extras from the environment
marker system altogether and just have a mapping of extras instead,
ala setuptools.  But that can be treated as a separate issue from the
'None' problem.)


More information about the Distutils-SIG mailing list