Message61075
Logged In: YES
user_id=31435
Because Python has a full-blown exception system, it's
generally better to test for the feature you need than to
compare mysterious little integers. For example, suppose
you need list comprehensions. You have no idea which
version of Python first introduced them, and once you think
you've got it figured out, readers of your code are going
to have no idea that you *meant* "list comprehensions" when
you compare sys.version_info against (2, 0). So clearer
all around is:
try:
. eval("[i for i in range(2)]")
except SyntaxError:
. raise ImportError, "I require list comprehensions" |
|
Date |
User |
Action |
Args |
2008-01-20 09:59:17 | admin | link | issue491331 messages |
2008-01-20 09:59:17 | admin | create | |
|