1"""
2A resurrection of some old functions from Python 2 for use in Python 3. These
3should be used sparingly, to help with porting efforts, since code using them
4is no longer standard Python 3 code.
5
6This module provides the following:
7
81. Implementations of these builtin functions which have no equivalent on Py3:
9
10- apply
11- chr
12- cmp
13- execfile
14
152. Aliases:
16
17- intern <- sys.intern
18- raw_input <- input
19- reduce <- functools.reduce
20- reload <- imp.reload
21- unichr <- chr
22- unicode <- str
23- xrange <- range
24
253. List-producing versions of the corresponding Python 3 iterator-producing functions:
26
27- filter
28- map
29- range
30- zip
31
324. Forward-ported Py2 types:
33
34- basestring
35- dict
36- str
37- long
38- unicode
39
40"""
41
42from future.utils import PY3
43from past.builtins.noniterators import (filter, map, range, reduce, zip)
44# from past.builtins.misc import (ascii, hex, input, oct, open)
45if PY3:
46 from past.types import (basestring,
47 olddict as dict,
48 oldstr as str,
49 long,
50 unicode)
51else:
52 from __builtin__ import (basestring, dict, str, long, unicode)
53
54from past.builtins.misc import (apply, chr, cmp, execfile, intern, oct,
55 raw_input, reload, unichr, unicode, xrange)
56from past import utils
57
58
59if utils.PY3:
60 # We only import names that shadow the builtins on Py3. No other namespace
61 # pollution on Py3.
62
63 # Only shadow builtins on Py3; no new names
64 __all__ = ['filter', 'map', 'range', 'reduce', 'zip',
65 'basestring', 'dict', 'str', 'long', 'unicode',
66 'apply', 'chr', 'cmp', 'execfile', 'intern', 'raw_input',
67 'reload', 'unichr', 'xrange'
68 ]
69
70else:
71 # No namespace pollution on Py2
72 __all__ = []