mirror of
https://github.com/python/cpython.git
synced 2024-11-24 10:24:35 +08:00
Add an item about the extension to {}.update() to allow generic
mapping objects as an argument.
This commit is contained in:
parent
41775385df
commit
51acc8d363
@ -90,6 +90,11 @@ Core
|
||||
- Dictionary objects now support the "in" operator: "x in dict" means
|
||||
the same as dict.has_key(x).
|
||||
|
||||
- The update() method of dictionaries now accepts generic mapping
|
||||
objects. Specifically the argument object must support the .keys()
|
||||
and __getitem__() methods. This allows you to say, for example,
|
||||
{}.update(UserDict())
|
||||
|
||||
- Iterators were added; this is a generalized way of providing values
|
||||
to a for loop. See PEP 234. There's a new built-in function iter()
|
||||
to return an iterator. There's a new protocol to get the next value
|
||||
|
Loading…
Reference in New Issue
Block a user