aboutsummaryrefslogtreecommitdiff
path: root/elogv
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2018-05-14 17:35:58 +0200
committerGilles Dartiguelongue <eva@gentoo.org>2018-05-14 17:35:58 +0200
commit0d8608bc964451e0cb036e5af4733afab38c811b (patch)
tree82837d72464c1b8327b972c2ea78648853bec68e /elogv
parentDrop unused intermediate variable (diff)
downloadelogv-0d8608bc964451e0cb036e5af4733afab38c811b.tar.gz
elogv-0d8608bc964451e0cb036e5af4733afab38c811b.tar.bz2
elogv-0d8608bc964451e0cb036e5af4733afab38c811b.zip
Use yield rather than returning an iterator in generator function
Diffstat (limited to 'elogv')
-rwxr-xr-xelogv7
1 files changed, 2 insertions, 5 deletions
diff --git a/elogv b/elogv
index e12cced..049a1bf 100755
--- a/elogv
+++ b/elogv
@@ -550,15 +550,12 @@ class ElogViewer:
for line in self.logf.readlines():
if not line.strip():
# textwrap eats newlines
- result.append("\n")
+ yield "\n"
else:
# Returns a list of new lines minus the line ending \n
wrapped_line = textwrap.wrap(line, width=self.width-2)
for l in wrapped_line:
- l += "\n"
- result.append(l)
-
- return iter(result)
+ yield l + "\n"
def show_log(self):
"""