diff options
| author | Chris McDonough <chrism@plope.com> | 2011-11-11 13:46:46 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-11-11 13:46:46 -0500 |
| commit | 09f3bd21398b329de6d214dd62926d7032c3c7cb (patch) | |
| tree | 646eed42e79df511cc8073804a7f4b1f38a51711 /docs/api/compat.rst | |
| parent | 5cf9fc8ab86e6ec6b76dd9d80cd8dcab42384cc6 (diff) | |
| download | pyramid-09f3bd21398b329de6d214dd62926d7032c3c7cb.tar.gz pyramid-09f3bd21398b329de6d214dd62926d7032c3c7cb.tar.bz2 pyramid-09f3bd21398b329de6d214dd62926d7032c3c7cb.zip | |
alphabetize
Diffstat (limited to 'docs/api/compat.rst')
| -rw-r--r-- | docs/api/compat.rst | 139 |
1 files changed, 70 insertions, 69 deletions
diff --git a/docs/api/compat.rst b/docs/api/compat.rst index cb8cf918f..bb34f38e4 100644 --- a/docs/api/compat.rst +++ b/docs/api/compat.rst @@ -10,68 +10,108 @@ systems which require compatibility imports. .. automodule:: pyramid.compat - .. attribute:: PYPY - - ``True`` if running on PyPy, ``False`` otherwise. - - .. attribute:: PY3 - - ``True`` if running on Python 3, ``False`` otherwise. + .. autofunction:: ascii_native_ - .. attribute:: pickle + .. attribute:: binary_type - ``cPickle`` module if it exists, ``pickle`` module otherwise. + Binary type for this platform. For Python 3, it's ``bytes``. For + Python 2, it's ``str``. - .. attribute:: im_func + .. autofunction:: bytes_ + + .. attribute:: class_types - On Python 2, the string value ``im_func``, on Python 3, the string - value ``__func__``. + Sequence of class types for this platform. For Python 3, it's + ``(type,)``. For Python 2, it's ``(type, types.ClassType)``. .. attribute:: configparser On Python 2, the ``ConfigParser`` module, on Python 3, the ``configparser`` module. - .. attribute:: SimpleCookie + .. function:: escape(v) - On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the - ``http.cookies.SimpleCookie`` module. + On Python 2, the ``cgi.escape`` function, on Python 3, the + ``html.escape`` function. - .. attribute:: string_types + .. function:: exec_(code, globs=None, locs=None) - Sequence of string types for this platform. For Python 3, it's - ``(str,)``. For Python 2, it's ``(basestring,)``. + Exec code in a compatible way on both Python 2 and 3. + + .. attribute:: im_func + + On Python 2, the string value ``im_func``, on Python 3, the string + value ``__func__``. + + .. function:: input_(v) + + On Python 2, the ``raw_input`` function, on Python 3, the + ``input`` function. .. attribute:: integer_types Sequence of integer types for this platform. For Python 3, it's ``(int,)``. For Python 2, it's ``(int, long)``. - .. attribute:: class_types + .. function:: is_nonstr_iter(v) - Sequence of class types for this platform. For Python 3, it's - ``(type,)``. For Python 2, it's ``(type, types.ClassType)``. + Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and + Python 3. - .. attribute:: text_type + .. function:: iteritems_(d) - Text type for this platform. For Python 3, it's ``str``. For Python - 2, it's ``unicode``. + Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2. - .. attribute:: binary_type + .. function:: itervalues_(d) - Binary type for this platform. For Python 3, it's ``bytes``. For - Python 2, it's ``str``. + Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2. + + .. function:: iterkeys_(d) + + Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2. .. attribute:: long Long type for this platform. For Python 3, it's ``int``. For Python 2, it's ``long``. + .. function:: map_(v) + + Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2. + + .. attribute:: pickle + + ``cPickle`` module if it exists, ``pickle`` module otherwise. + + .. attribute:: PY3 + + ``True`` if running on Python 3, ``False`` otherwise. + + .. attribute:: PYPY + + ``True`` if running on PyPy, ``False`` otherwise. + + .. function:: reraise(tp, value, tb=None) + + Reraise an exception in a compatible way on both Python 2 and Python 3, + e.g. ``reraise(*sys.exc_info())``. + + .. attribute:: string_types + + Sequence of string types for this platform. For Python 3, it's + ``(str,)``. For Python 2, it's ``(basestring,)``. + + .. attribute:: SimpleCookie + + On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the + ``http.cookies.SimpleCookie`` module. + .. autofunction:: text_ - .. autofunction:: bytes_ - - .. autofunction:: ascii_native_ + .. attribute:: text_type + + Text type for this platform. For Python 3, it's ``str``. For Python + 2, it's ``unicode``. .. autofunction:: native_ @@ -114,42 +154,3 @@ systems which require compatibility imports. On Python 2, return ``native_(url_unquote_text_v, encoding, errors))``; on Python 3, return the result of ``urllib.parse.unquote``. - .. function:: reraise(tp, value, tb=None) - - Reraise an exception in a compatible way on both Python 2 and Python 3, - e.g. ``reraise(*sys.exc_info())``. - - .. function:: exec_(code, globs=None, locs=None) - - Exec code in a compatible way on both Python 2 and 3. - - .. function:: iteritems_(d) - - Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2. - - .. function:: itervalues_(d) - - Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2. - - .. function:: iterkeys_(d) - - Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2. - - .. function:: map_(v) - - Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2. - - .. function:: is_nonstr_iter(v) - - Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and - Python 3. - - .. function:: escape(v) - - On Python 2, the ``cgi.escape`` function, on Python 3, the - ``html.escape`` function. - - .. function:: input_(v) - - On Python 2, the ``raw_input`` function, on Python 3, the - ``input`` function. |
