Add Support for indexing

Issue #3 new
Timothy Wiseman
created an issue

Adding support for indexing by adding:

{{{

!python

def getitem(self, index): return getattr(self, self.slots[index])

def setitem(self, index, value): return setattr(self, self.slots[index], value) }}}

to the class definitions would make it closer to a mutable namedtuple since namedtuple supports indexing.

Comments (6)

  1. ericvsmith repo owner

    Do you have some particular use case for this? It's my experience that indexing namedtuple's has caused me a bug or two, and I've never actually wanted the feature.

  2. Log in to comment