[Tutor] Checking for Python version
steve at alchemy.com
Tue Oct 6 16:57:50 CEST 2009
On Tue, Oct 06, 2009 at 09:47:43AM -0500, Wayne wrote:
> On Tue, Oct 6, 2009 at 9:46 AM, Steve Willoughby <steve at alchemy.com> wrote:
> > On Tue, Oct 06, 2009 at 09:42:04AM -0500, Wayne wrote:
> > > On Tue, Oct 6, 2009 at 9:26 AM, Christian Witts <cwitts at compuscan.co.za
> > >wrote:
> > > if sys.version < '2.4':
> > > sys.exit("Need at least Python 2.4")
> > >
> > > AFAIK the string comparison is reliable
> > Not quite. What happens when you compare '2.4' and '2.10'?
> >>> '2.4' > '2.10'
Exactly. So it doesn't work.
In typical software release numbering, 2.10 is the tenth
minor version of the 2.x major version series, so 2.10 is
later than 2.4, but comparing as ASCII strings, it comes
out the other way around.
Also note that '10.1' < '5.7'
Steve Willoughby | Using billion-dollar satellites
steve at alchemy.com | to hunt for Tupperware.
More information about the Tutor