Message235089
The example is:
def convert_arg_line_to_args(self, arg_line):
for arg in arg_line.split():
if not arg.strip():
continue
yield arg
str.split() with default delimiters never returns empty or whitespace strings in the list.
>>> ' x x '.split()
['x', 'x']
>>> ' '.split()
[]
>>>
Therefore, the if condition doesn't ever continue the loop.
It can be written:
def convert_arg_line_to_args(self, arg_line):
for arg in arg_line.split():
yield arg
It's the same as:
def convert_arg_line_to_args(self, arg_line):
return iter(arg_line.split())
I guess, nothing uses next() for the result:
def convert_arg_line_to_args(self, arg_line):
return arg_line.split()
Applied a patch with the last variant. |
|
Date |
User |
Action |
Args |
2015-01-31 08:40:39 | py.user | set | recipients:
+ py.user, docs@python |
2015-01-31 08:40:39 | py.user | set | messageid: <1422693639.9.0.487352753219.issue23356@psf.upfronthosting.co.za> |
2015-01-31 08:40:39 | py.user | link | issue23356 messages |
2015-01-31 08:40:39 | py.user | create | |
|