#!/usr/bin/env python > 2.4?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Mar 23 05:59:20 CET 2007


En Wed, 21 Mar 2007 07:07:20 -0300, Jon Ribbens  
<jon+usenet at unequivocal.co.uk> escribió:

> In article <etpcon$1g8r$1 at ulysses.news.tiscali.de>, Stargaming wrote:
>> from sys import version_info
>> if version_info[0] < 2 or version_info[1] < 4:
>>      raise RuntimeError("You need at least python2.4 to run this  
>> script")
>
> That'll fail when the major version number is increased (i.e. Python  
> 3.0).
>
> You want:
>
>   if sys.hexversion < 0x020400f0:
>     ... error ...

(what means the final f0?) I find a lot easier to use (and read) this:

if sys.version_info < (2,4):
	raise RuntimeError("You need at least python2.4...")

(Does the f0 account for the prereleases?)
-- 
Gabriel Genellina




More information about the Python-list mailing list