"consume the generator"?

Despite the comment, I don't understand the purpose of the

    > last line in the following excerpt from the Axes.plot()
    > method:

    > lines = for line in self._get_lines(*args,
    > **kwargs): self.add_line(line) lines.append(line) lines =
    > [line for line in lines] # consume the generator

That looks like detritus. If I recall correctly, it used to be
something like

         lines = self._get_lines(*args, **kwargs):
         lines = [line for line in lines] # consume the generator

_get_lines is a generator and there was some part of the code that was
having trouble with this so I just converted it to a list and that
fixed the bug. Later it appears the code was rewritten to what you
posted and lines is already a list, so yes, the list comprehension is
redundant and should be removed.

JDH

John,

Thanks. I have deleted it.

Eric

John Hunter wrote:

···

    > Despite the comment, I don't understand the purpose of the
    > last line in the following excerpt from the Axes.plot()
    > method:

    > lines = for line in self._get_lines(*args,
    > **kwargs): self.add_line(line) lines.append(line) lines =
    > [line for line in lines] # consume the generator

That looks like detritus. If I recall correctly, it used to be
something like

         lines = self._get_lines(*args, **kwargs):
         lines = [line for line in lines] # consume the generator

_get_lines is a generator and there was some part of the code that was
having trouble with this so I just converted it to a list and that
fixed the bug. Later it appears the code was rewritten to what you
posted and lines is already a list, so yes, the list comprehension is
redundant and should be removed.

JDH