File: _py3k_compat.py

package info (click to toggle)
python-mplexporter 0.0.1%2B20140921-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 220 kB
  • ctags: 133
  • sloc: python: 940; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 440 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Simple fixes for Python 2/3 compatibility
"""
import sys
PY3K = sys.version_info[0] >= 3


if PY3K:
    import builtins
    import functools
    reduce = functools.reduce
    zip = builtins.zip
    xrange = builtins.range
    map = builtins.map
else:
    import __builtin__
    import itertools
    builtins = __builtin__
    reduce = __builtin__.reduce
    zip = itertools.izip
    xrange = __builtin__.xrange
    map = itertools.imap