Mercurial > babel > mirror
comparison babel/compat.py @ 567:c81a11cb1476 trunk
add a compat module to shield the code from changes in different versions of Python
author | fschwarz |
---|---|
date | Mon, 26 Sep 2011 09:42:43 +0000 |
parents | |
children | 8ce41e60f90d |
comparison
equal
deleted
inserted
replaced
566:593157da23f3 | 567:c81a11cb1476 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 # | |
3 # Copyright (C) 2007-2011 Edgewall Software | |
4 # All rights reserved. | |
5 # | |
6 # This software is licensed as described in the file COPYING, which | |
7 # you should have received as part of this distribution. The terms | |
8 # are also available at http://babel.edgewall.org/wiki/License. | |
9 # | |
10 # This software consists of voluntary contributions made by many | |
11 # individuals. For the exact contribution history, see the revision | |
12 # history and logs, available at http://babel.edgewall.org/log/. | |
13 | |
14 try: | |
15 from xml.etree import ElementTree | |
16 except ImportError: | |
17 from elementtree import ElementTree | |
18 | |
19 try: | |
20 any = any | |
21 except NameError: | |
22 def any(iterable): | |
23 return filter(None, list(iterable)) | |
24 | |
25 try: | |
26 import threading | |
27 except ImportError: | |
28 import dummy_threading as threading | |
29 |