Message238186
This is from the documentation at Section 4.6.4. Lists
"""
Lists may be constructed in several ways:
Using a pair of square brackets to denote the empty list: []
Using square brackets, separating items with commas: [a], [a, b, c]
Using a list comprehension: [x for x in iterable]
Using the type constructor: list() or list(iterable)
"""
Comprehensions are mentioned as a constructor.
This is from the documentation at Section 4.10. Mapping Types
"""
Dictionaries can be created by placing a comma-separated list of key: value pairs within braces, for example: {'jack': 4098, 'sjoerd': 4127} or {4098: 'jack', 4127: 'sjoerd'}, or by the dict constructor.
class dict(**kwarg)
class dict(mapping, **kwarg)
class dict(iterable, **kwarg)
Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments.
"""
There is no mention of dictionary comprehensions.
For consistency, I believe that the documentation for Dicts and Sets should mention comprehensions. |
|
Date |
User |
Action |
Args |
2015-03-16 08:50:55 | FrankMillman | set | recipients:
+ FrankMillman, docs@python |
2015-03-16 08:50:55 | FrankMillman | set | messageid: <1426495855.1.0.56894829498.issue23677@psf.upfronthosting.co.za> |
2015-03-16 08:50:55 | FrankMillman | link | issue23677 messages |
2015-03-16 08:50:54 | FrankMillman | create | |
|