浏览代码

Implement next() for Python 2.5

Matthew Wang 12 年前
父节点
当前提交
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