mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)
* Replaced list(<generator expression>) with list comprehension * Replaced dict(<generator expression>) with dict comprehension * Replaced set(<list literal>) with set literal * Replaced builtin func(<list comprehension>) with func(<generator expression>) when supported (e.g. any(), all(), tuple(), min(), & max())
This commit is contained in:
parent
906f5330b9
commit
3972628de3
19 changed files with 32 additions and 39 deletions
|
@ -463,7 +463,7 @@ class BaseConfigurator(object):
|
|||
c = self.resolve(c)
|
||||
props = config.pop('.', None)
|
||||
# Check for valid identifiers
|
||||
kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])
|
||||
kwargs = dict((k, config[k]) for k in config if valid_ident(k))
|
||||
result = c(**kwargs)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
|
@ -726,7 +726,7 @@ class DictConfigurator(BaseConfigurator):
|
|||
config['address'] = self.as_tuple(config['address'])
|
||||
factory = klass
|
||||
props = config.pop('.', None)
|
||||
kwargs = dict([(k, config[k]) for k in config if valid_ident(k)])
|
||||
kwargs = dict((k, config[k]) for k in config if valid_ident(k))
|
||||
try:
|
||||
result = factory(**kwargs)
|
||||
except TypeError as te:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue