← Back to team overview

larry-discuss team mailing list archive

Re: A new proposal for indexing with labels

 

Here's a first pass at lix:

>> idx = lix(['a', 'b'])
>> label = ['a', 'b', 'c']
>> idx.index(label)
   [0, 1]

class lix(object):

    def __init__(self, label):
        if type(label) != list:
            raise TypeError, 'label must be a list'
        self.label = label

    def index(self, label):
        return map(label.index, self.label)

    def __repr__(self):
        return 'larry label index object: \n' + str(self.label)



References