[Distutils] FINAL DRAFT: Dependency specifier PEP

Robert Collins robertc at robertcollins.net
Mon Nov 16 21:11:36 EST 2015


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.

So - no reason to break compat, though the grammar could perhaps be
tweaked if we want to write an inline evaluator. The same expressions
would be accepted either way. I think its worth copying the Python
rules into the PEP though for clarity.

-Rob



-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud


More information about the Distutils-SIG mailing list