-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Open
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
Description
The docstring of dict() doesn't match the doc of dict()
and it isn't so understandable as shown below:
print(help(dict))
# class dict(object)
# | dict() -> new empty dictionary
# | dict(mapping) -> new dictionary initialized from a mapping object's
# | (key, value) pairs
# | dict(iterable) -> new dictionary initialized as if via:
# | d = {}
# | for k, v in iterable:
# | d[k] = v
# | dict(**kwargs) -> new dictionary initialized with the name=value pairs
# | in the keyword argument list. For example: dict(one=1, two=2)
So, it should be like below:
dict(**kwargs) -> E.g. dict(key1=value1, key2=value2)
dict(mapping, **kwargs) ->mapping
is the dictionary made by mapping object
dict(iterable, **kwargs) ->iterable
is e.g. [('key1', 'value1'), ('key2', 'value2')]) treated by {k:v for k, v in iterable}
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
Projects
Status
Todo