Skip to content

Commit

Permalink
Minor modernization
Browse files Browse the repository at this point in the history
This should also bring a minor performance gain.
  • Loading branch information
dnicolodi committed Jan 19, 2022
1 parent 33f7328 commit c21d5c3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions petl/util/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,11 @@ def frozenset(self):

def list(self):
# avoid iterating twice
l = list()
for i in iter(self):
l.append(i)
return l
return list(iter(self))

def tuple(self):
# avoid iterating twice
return tuple(self.list())
return tuple(iter(self))

def dict(self, **kwargs):
return dict(self, **kwargs)
Expand Down

0 comments on commit c21d5c3

Please sign in to comment.