mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Issue #23275: Allow () = iterable assignment syntax
Documentation updates by Martin Panter.
This commit is contained in:
parent
93d22ecc7c
commit
094c9c921c
7 changed files with 41 additions and 41 deletions
|
@ -117,6 +117,27 @@ error)
|
|||
...
|
||||
test.test_unpack.BozoError
|
||||
|
||||
Allow unpacking empty iterables
|
||||
|
||||
>>> () = []
|
||||
>>> [] = ()
|
||||
>>> [] = []
|
||||
>>> () = ()
|
||||
|
||||
Unpacking non-iterables should raise TypeError
|
||||
|
||||
>>> () = 42
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
TypeError: 'int' object is not iterable
|
||||
|
||||
Unpacking to an empty iterable should raise ValueError
|
||||
|
||||
>>> () = [42]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ValueError: too many values to unpack (expected 0)
|
||||
|
||||
"""
|
||||
|
||||
__test__ = {'doctests' : doctests}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue