At 02:20 PM 6/22/2006 -0400, Jim Fulton wrote:
>On Jun 22, 2006, at 1:56 PM, Jim Fulton wrote:
>>
>>I assume you are alluding to what I assume is the case that that
>>there is an implicit
>> >-infinity and <infinity, so the above example becomes:
>
>No, that can't be right. If that were so, then
>
> ==1.2 would be meaningless
>
>So I have no idea what you were trying to say.
The infinities are implied only if they are needed to complete a pairing
with an actual condition.
>The more I find out about the specification specification, the
>less I understand it.
Exactly, so stop trying to understand it, and you'll see how obvious it is. :)
The implementation scans from left to right until it's *sure* that the
version is either accepted or rejected. Each condition is a point, a
bound, or a point and a bound. If the version matches the "point" part of
condition, it's an exact match and you are *sure* of an accept, unless it's
a "!=", in which case you're *sure* it's a reject.
If the version falls below an upper bound (< or <=), you are also *sure*
that it's accepted. If it is above an upper bound, it is *tentatively*
rejected.
If the version falls below a lower bound (> or >=), you are *sure* that
it's rejected. If it is above a lower bound, it is *tentatively* accepted.
If you reach the end of the conditions without being "sure" of anything,
then your most recent tentative acceptance or rejection is used.
A simple state machine is used to implement this:
state_machine = {
# =><
'<' : '--T',
'<=': 'T-T',
'>' : 'F+F',
'>=': 'T+F',
'==': 'T..',
'!=': 'F++',
}
cmp() is used to determine whether the version is =, >, or < than the
condition's version, and the appropriate row and column is pulled from the
above table. "T" means "sure accept", "F" means "sure reject", "+" means
"tentative accept", and "-" means "tentative reject". ("." means "don't
care".) The state machine simply compares versions until its sure or there
are no more to compare.
_______________________________________________
Distutils-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig