Re: handling 0 < x < 5
Ben Collins <[email protected]> Mon, 29 Mar 2004 16:11:28 -0500
| Newsgroups | gmane.comp.lang.prothon.devel |
|---|---|
| Message-ID | <[email protected]> |
> I doubt if this is handled by the parser in Python--rather, the > compiler probably looks at a given comparison binary operator to see if > one or more of its children are other comparison ops, and compiles the > appropriate chained comparisons. Just a thought. Well, it could be handled by the parser. Basically you need to turn: 0 < x < 5 into (0 < x) && (x < 5) Basically we need to detect and do a group True/False check on each adjacent set of values. So something like: 0 < a > b < c > 10 Would be (0 < a) && (a > b) && (b < c) && (c > 10) Looks complicated, but I think I can do it in the parser without too much trouble. -- Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ WatchGuard - http://www.watchguard.com/