This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author py.user
Recipients docs@python, py.user
Date 2015-01-31.08:40:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422693639.9.0.487352753219.issue23356@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-01-31 08:40:39py.usersetrecipients: + py.user, docs@python
2015-01-31 08:40:39py.usersetmessageid: <1422693639.9.0.487352753219.issue23356@psf.upfronthosting.co.za>
2015-01-31 08:40:39py.userlinkissue23356 messages
2015-01-31 08:40:39py.usercreate