diff options
| author | Xavier Morel <xmo@odoo.com> | 2017-04-11 17:29:18 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2017-04-11 17:29:18 +0200 |
| commit | f1168d06c0415092c4adc9c2c6917ac5e67a1420 (patch) | |
| tree | c0f90a8705547f098e64f52665d9a2e6a18ebf23 /doc/python3.rst | |
| parent | 0b3ea57e616f37edaaf131c08a23a34cf715c1d6 (diff) | |
[#8530] fix octal literals (and remove unwittingly octals)
For readability and coherence, in Python 3 the prefix for octal
literal becomes ``0o`` (rather than just ``0``). This new version was
also added to Python 2 as of 2.6.
Convert all octal literals in file-manipulation code (POSIX ACL), and
fix a few integers which were unwittingly octal.
(lib2to3.fixes.fix_numliterals)
Diffstat (limited to 'doc/python3.rst')
| -rw-r--r-- | doc/python3.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/python3.rst b/doc/python3.rst index b339e0a98b0..4506fb9d9f1 100644 --- a/doc/python3.rst +++ b/doc/python3.rst @@ -109,3 +109,23 @@ Removed/renamed methods ``in`` for dicts was introduced in Python 2.3, leading to ``has_key`` being redundant, and removed in Python 3. + +Minor syntax changes +-------------------- + +* the ability to unpack a parameter (in the parameter declaration list) has + been removed in Python 3 e.g.:: + + def foo((bar, baz), qux): + … + + is now invalid + +* octal literals must be prefixed by ``0o`` (or ``0O``). Following the C + family, in Python 2 an octal literal simply has a leading 0, which can be + confusing and easy to get wrong when e.g. padding for readability (e.g. + ``0013`` would be the decimal 11 rather than 13). + + In Python 3, leading zeroes followed by neither a 0 nor a period is an + error, octal literals now follow the hexadecimal convention with a ``0o`` + prefix. |
