Skip to content

Commit 8c3d9a0

Browse files
committed
Python 2.4 compatibility
1 parent 4cbd2bf commit 8c3d9a0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/html5lib/html5parser.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
# Import from the sets module for python 2.3
55
from sets import Set as set
66
from sets import ImmutableSet as frozenset
7+
8+
try:
9+
any
10+
except:
11+
# Implement 'any' for python 2.4 and previous
12+
def any(iterable):
13+
for element in iterable:
14+
if element:
15+
return True
16+
return False
17+
718
import sys
819

920
import inputstream

0 commit comments

Comments
 (0)