[Distutils] FINAL DRAFT: Dependency specifier PEP

Nathaniel Smith njs at pobox.com
Mon Nov 16 21:42:51 EST 2015

On Mon, Nov 16, 2015 at 6:11 PM, Robert Collins
<robertc at robertcollins.net> wrote:
> On 17 November 2015 at 14:49, Donald Stufft <donald at stufft.io> wrote:
> ...
>>> ('name', [], [], (('posix', '==', 'dud'), [('and', ('posix', '==',
>>> 'odd')), ('or', ('posix', '==', 'fred'))]))
>>> which can just be rolled up left to right.
>> Should we use the same rules as Python in order to maintain compatibility or is there a compelling reason to break compatibility here?
> So for clarity:
> True and -> right hand side evaluated stand alone
> False and -> False
> True or -> True
> False or -> right hand side evaluated stand alone
> We can roll that up using the parse tree:
> (('posix', '==', 'dud'), [('and', ('posix', '==', 'odd')), ('or',
> ('posix', '==', 'fred'))]))
> evaluate the start to get a 'result'
> pop an expression from the beginning of the list giving opcode, next.
> lookup (result, opcode) in the above truth table, giving one of True,
> False, None
> on None, result = next and loop.
> on True or False, return that.

Not sure if we're communicating or not? The case I'm concerned about is

a or b and c

which Python parses as (a or (b and c)) because 'and' has higher
precedence than 'or'. So for example in Python,

True or True and False

returns True, but if you use a left-to-right evaluation rule than it
returns False.


Nathaniel J. Smith -- http://vorpus.org

More information about the Distutils-SIG mailing list