Skip to content
6 changes: 3 additions & 3 deletions Lib/_pydecimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ def logical_and(self, other, context=None):
(opa, opb) = self._fill_logical(context, self._int, other._int)

# make the operation, and clean starting zeroes
result = "".join([str(int(a)&int(b)) for a,b in zip(opa,opb)])
result = "".join(str(int(a)&int(b)) for a,b in zip(opa,opb))
return _dec_from_triple(0, result.lstrip('0') or '0', 0)

def logical_invert(self, context=None):
Expand All @@ -3415,7 +3415,7 @@ def logical_or(self, other, context=None):
(opa, opb) = self._fill_logical(context, self._int, other._int)

# make the operation, and clean starting zeroes
result = "".join([str(int(a)|int(b)) for a,b in zip(opa,opb)])
result = "".join(str(int(a)|int(b)) for a,b in zip(opa,opb))
return _dec_from_triple(0, result.lstrip('0') or '0', 0)

def logical_xor(self, other, context=None):
Expand All @@ -3432,7 +3432,7 @@ def logical_xor(self, other, context=None):
(opa, opb) = self._fill_logical(context, self._int, other._int)

# make the operation, and clean starting zeroes
result = "".join([str(int(a)^int(b)) for a,b in zip(opa,opb)])
result = "".join(str(int(a)^int(b)) for a,b in zip(opa,opb))
return _dec_from_triple(0, result.lstrip('0') or '0', 0)

def max_mag(self, other, context=None):
Expand Down
19 changes: 10 additions & 9 deletions Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def format_help(self):
return help

def _join_parts(self, part_strings):
return ''.join([part
for part in part_strings
if part and part is not SUPPRESS])
return "".join(
part for part in part_strings if part and part is not SUPPRESS
)

def _format_usage(self, usage, actions, groups, prefix):
if prefix is None:
Expand Down Expand Up @@ -621,7 +621,7 @@ def _expand_help(self, action):
if hasattr(params[name], '__name__'):
params[name] = params[name].__name__
if params.get('choices') is not None:
choices_str = ', '.join([str(c) for c in params['choices']])
choices_str = ", ".join(str(c) for c in params['choices'])
params['choices'] = choices_str
return self._get_help_string(action) % params

Expand Down Expand Up @@ -1588,9 +1588,9 @@ def _handle_conflict_error(self, action, conflicting_actions):
message = ngettext('conflicting option string: %s',
'conflicting option strings: %s',
len(conflicting_actions))
conflict_string = ', '.join([option_string
for option_string, action
in conflicting_actions])
conflict_string = ", ".join(
option_string for option_string, action in conflicting_actions
)
raise ArgumentError(action, message % conflict_string)

def _handle_conflict_resolve(self, action, conflicting_actions):
Expand Down Expand Up @@ -2163,8 +2163,9 @@ def _match_arguments_partial(self, actions, arg_strings_pattern):
result = []
for i in range(len(actions), 0, -1):
actions_slice = actions[:i]
pattern = ''.join([self._get_nargs_pattern(action)
for action in actions_slice])
pattern = "".join(
self._get_nargs_pattern(action) for action in actions_slice
)
match = _re.match(pattern, arg_strings_pattern)
if match is not None:
result.extend([len(string) for string in match.groups()])
Expand Down
8 changes: 1 addition & 7 deletions Lib/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,7 @@ def _splitlines_no_ff(source):

def _pad_whitespace(source):
r"""Replace all chars except '\f\t' in a line with spaces."""
result = ''
for c in source:
if c in '\f\t':
result += c
else:
result += ' '
return result
return "".join(c if c in "\f\t" else " " for c in source)


def get_source_segment(source, node, *, padded=False):
Expand Down