Mercurial > ~astiob > upreckon > hgweb
comparison 2.00/compat.py @ 35:23aa8da5be5f
compat.py now emulates the next() built-in in Python 2.5
| author | Oleg Oshmyan <chortos@inbox.lv> |
|---|---|
| date | Fri, 03 Dec 2010 01:19:55 +0000 |
| parents | 8fec38b0dd6e |
| children |
comparison
equal
deleted
inserted
replaced
| 34:8fec38b0dd6e | 35:23aa8da5be5f |
|---|---|
| 151 callable = callable | 151 callable = callable |
| 152 except NameError: | 152 except NameError: |
| 153 callable = lambda obj: hasattr(obj, '__call__') | 153 callable = lambda obj: hasattr(obj, '__call__') |
| 154 | 154 |
| 155 try: | 155 try: |
| 156 next = next | |
| 157 except NameError: | |
| 158 next = lambda obj: obj.next() | |
| 159 | |
| 160 try: | |
| 156 from itertools import imap as map | 161 from itertools import imap as map |
| 157 except ImportError: | 162 except ImportError: |
| 158 map = map | 163 map = map |
| 159 | 164 |
| 160 try: | 165 try: |
