Commit 1849eade authored by Hans van den Heuvel's avatar Hans van den Heuvel
Browse files

Better implemenation of datasheet iterator.

parent 52ec86a4
......@@ -365,15 +365,7 @@ class DataSet:
# It is usefull to be able to iterate over all the datasheets.
# Basically, avoid using .list. in all DataSet references.
def __iter__(self):
self.n = 0
return self
def __next__(self):
if self.n < len(self.list):
self.n = self.n + 1
return getattr(self, self.list[self.n-1])
else:
raise StopIteration
return iter(self.list)
# Container for all the files
def add(self, name, default_name, default_dir, short_argument=None,
......@@ -381,6 +373,7 @@ class DataSet:
necessary=True):
if getattr(self, name, None) is None:
# Create a new sheet with a different name
# directly under this class. Then no .list is needed
setattr(self,
name,
DataSheet(
......@@ -391,7 +384,7 @@ class DataSet:
direction=direction,
checksum=checksum,
autoload=autoload))
# But we must do some bookkeeping
self.list.append(name)
long_argument = '--'+name+'_file'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment