python-future/docs/future-builtins.rst

18 lines
457 B
ReStructuredText
Raw Normal View History

2022-05-14 02:47:09 +08:00
.. _future-builtins:
``future.builtins``
===================
The ``future.builtins`` module is also accessible as ``builtins`` on Py2.
- ``pow()`` supports fractional exponents of negative numbers like in Py3::
>>> from builtins import pow
>>> pow(-1, 0.5)
(6.123233995736766e-17+1j)
- ``round()`` uses Banker's Rounding as in Py3 to the nearest even last digit::
>>> from builtins import round
>>> assert round(0.1250, 2) == 0.12