diff options
Diffstat (limited to 'doc/python3.rst')
| -rw-r--r-- | doc/python3.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/python3.rst b/doc/python3.rst index 4506fb9d9f1..cb60965eb6c 100644 --- a/doc/python3.rst +++ b/doc/python3.rst @@ -99,6 +99,21 @@ Removed Operators These two operators were long recommended against/deprecated in Python 2, Python 3 removed them from the language. +Removed/renamed builtins +------------------------ + +``reduce`` +########## + +In Python 3, ``reduce`` has been demoted from builtin to ``functools.reduce``. +However this is because many (if not most) uses of ``reduce`` can be replaced +by ``sum``, ``all``, ``any`` or a list comprehension for a more readable and +faster result. + +It is easy enough to just add ``from functools import reduce`` to the file +and compatible with Python 2.6 and later, but consider whether you get better +code by replacing it with some other method altogether. + Removed/renamed methods ----------------------- |
