Some PEP 505 fixes from Mark.

This commit is contained in:
Georg Brandl 2015-09-19 21:10:05 +02:00
parent e3e40dd1d2
commit d1a16cac54
1 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ work in Python::
>>> title ?? 'Default Title'
'My Title'
>>> title = None
>>> title ?? 'Bar'
>>> title ?? 'Default Title'
'Default Title'
Similar behavior can be achieved with the ``or`` operator, but ``or`` checks
@ -114,11 +114,11 @@ The ``None`` coalescing operator also has a corresponding assignment shortcut.
::
data ??= []
files ??= []
headers ??= {}
params ??= {}
hooks ??= {}
data ?= []
files ?= []
headers ?= {}
params ?= {}
hooks ?= {}
The ``None`` coalescing operator is left-associative, which allows for easy
chaining::
@ -127,7 +127,7 @@ chaining::
>>> local_default_title = None
>>> global_default_title = 'Global Default Title'
>>> title = user_title ?? local_default_title ?? global_default_title
'My Title'
'Global Default Title'
The direction of associativity is important because the ``None`` coalesing
operator short circuits: if its left operand is non-null, then the right