
On Jun 22, 2006, at 3:00 PM, Phillip J. Eby wrote:
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. :)
Ah, if only it was.
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.
So given: >1, <3, >5, <7 You are sure that 4 is accepted? Given: <2, <5 Is 3 accepted or 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.
So given: >1, <3, >5, <7 You are sure that 2 is rejected?
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.
I don't understand the meaning of the values in the dictionary above. Do the character positions reflect states somehow? Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org