mirror of https://github.com/python/cpython.git
Rephrase dict.fromkeys() news.
This commit is contained in:
parent
caf17be1b7
commit
c0d3f4e445
|
@ -270,10 +270,11 @@ Core and builtins
|
||||||
an optional argument that specifies the characters to strip. For
|
an optional argument that specifies the characters to strip. For
|
||||||
example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
|
example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
|
||||||
|
|
||||||
- Dictionaries have a new class method, fromkeys(iterable, value=None).
|
- There's a new dictionary constructor (a class method of the dict
|
||||||
It constructs a new dictionary with keys taken from the iterable and
|
class), dict.fromkeys(iterable, value=None). It constructs a
|
||||||
all values set to a single value. It is used for building membership
|
dictionary with keys taken from the iterable and all values set to a
|
||||||
tests and for removing duplicates from sequences.
|
single value. It can be used for building sets and for removing
|
||||||
|
duplicates from sequences.
|
||||||
|
|
||||||
- Added a new dict method pop(key). This removes and returns the
|
- Added a new dict method pop(key). This removes and returns the
|
||||||
value corresponding to key. [SF patch #539949]
|
value corresponding to key. [SF patch #539949]
|
||||||
|
|
Loading…
Reference in New Issue