diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2018-05-14 17:35:58 +0200 |
---|---|---|
committer | Gilles Dartiguelongue <eva@gentoo.org> | 2018-05-14 17:35:58 +0200 |
commit | 0d8608bc964451e0cb036e5af4733afab38c811b (patch) | |
tree | 82837d72464c1b8327b972c2ea78648853bec68e /elogv | |
parent | Drop unused intermediate variable (diff) | |
download | elogv-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-x | elogv | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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): """ |