소스 검색

Implement next() for Python 2.5

Matthew Wang 13 년 전
부모
커밋
12efc9d2c7
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6
    0
      cdiff.py

+ 6
- 0
cdiff.py 파일 보기

23
 if sys.hexversion < 0x02050000:
23
 if sys.hexversion < 0x02050000:
24
     raise SystemExit("*** Requires python >= 2.5.0")    # pragma: no cover
24
     raise SystemExit("*** Requires python >= 2.5.0")    # pragma: no cover
25
 
25
 
26
+# Python < 2.6 does not have next()
27
+try:
28
+    next
29
+except NameError:
30
+    def next(obj): return obj.next()
31
+
26
 import re
32
 import re
27
 import signal
33
 import signal
28
 import subprocess
34
 import subprocess