summaryrefslogtreecommitdiff
path: root/doc/python3.rst
diff options
context:
space:
mode:
authorAdrian Torres <adt@odoo.com>2018-11-08 15:27:30 +0000
committerAdrian Torres <adt@odoo.com>2018-11-29 09:28:17 +0000
commit52f5528cfb6d1152ee226e268247dc685a8ba329 (patch)
treeb44ecfa477b50dd3e488f09f623eecc8bc8e9d7d /doc/python3.rst
parente5c864a596b72515837f0ed1e07550398ecc1ab0 (diff)
[REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
Diffstat (limited to 'doc/python3.rst')
-rw-r--r--doc/python3.rst26
1 files changed, 0 insertions, 26 deletions
diff --git a/doc/python3.rst b/doc/python3.rst
index 88475d7dc4a..ac24983ceb7 100644
--- a/doc/python3.rst
+++ b/doc/python3.rst
@@ -299,8 +299,6 @@ under the single ``int`` type.
* the ``L`` suffix for integer literals must be removed
* calls to ``long`` must be replaced by calls to ``int``
- * ``(int, long)`` for type-checking purposes must be replaced by
- :py:data:`odoo.tools.pycompat.integer_types`
* the ``L`` suffix on numbers is unsupported in Python 3, and unnecessary in
@@ -311,18 +309,6 @@ under the single ``int`` type.
subtype of ``int`` (nor the reverse), and ``isinstance(value, (int, long))``
is thus generally necessary to catch all integrals.
- For that case, Odoo 11 now provides a compatibility module with an
- :py:data:`~odoo.tools.pycompat.integer_types` definition which can be used
- for type-testing.
-
- It is a tuple of types so when used with ``isinstance`` it can be provided
- directly or inside an other tuple alongside other types e.g.
- ``isinstance(value, (BaseModel, integer_types))``.
-
- However when used with ``type`` directly (which should be avoided) you
- should use the ``in`` operator, and if you need other types you need to
- concatenate ``integer_types`` to an other tuple.
-
``reduce``
##########
@@ -411,18 +397,6 @@ Both versions have the following prefixes for string literals:
For best cross-version compatibility you should avoid unprefixed string
literals unless you *specifically* need a "native string" [#native-string]_.
-For easier type-testing, :mod:`odoo.tools.pycompat` provides the following
-constants:
-
-* :data:`~odoo.tools.pycompat.string_types` is an alias/type tuple for testing
- string types, essentially a replacement of testing for ``basestring`` or
- ``(str, unicode)``.
-* :data:`~odoo.tools.pycompat.text_type` is the proper *text* type for the
- current version, it should mostly be used for converting non-bytes objects
- to text.
-* ``bytes`` should be avoided for type conversions, though it can be used to
- check if an object is a bytestring.
-
``open``
--------