1.1 --- a/simplex/readers.py Sun Oct 02 17:25:31 2011 +0200
1.2 +++ b/simplex/readers.py Sun Oct 02 17:40:02 2011 +0200
1.3 @@ -35,17 +35,17 @@
1.4
1.5 "An accessor using a delimiter to split a record."
1.6
1.7 - def __init__(self, keys=None, delimiter=None, numeric=0):
1.8 + def __init__(self, fields=None, delimiter=None, numeric=0):
1.9
1.10 """
1.11 - Initialise the accessor using a sequence of 'keys' indicating the
1.12 + Initialise the accessor using a sequence of 'fields' indicating the
1.13 columns in each record that provide the values in the eventual compound
1.14 - key provided by each record, along with a 'delimiter' indicating how
1.15 - such columns are identified. If 'numeric' is set to a true value, keys
1.16 + field provided by each record, along with a 'delimiter' indicating how
1.17 + such columns are identified. If 'numeric' is set to a true value, fields
1.18 will be interpreted as numbers.
1.19 """
1.20
1.21 - self.keys = keys or [0]
1.22 + self.fields = fields or [0]
1.23 self.delimiter = delimiter
1.24 self.convert = numeric and self.convert_numeric or (lambda x: x)
1.25
1.26 @@ -54,6 +54,6 @@
1.27
1.28 def get_key(self, record):
1.29 values = record.split(self.delimiter)
1.30 - return self.convert([values[key] for key in self.keys])
1.31 + return self.convert([values[field] for field in self.fields])
1.32
1.33 # vim: tabstop=4 expandtab shiftwidth=4