def __getitem__(self, idx): if not -self.length <= idx < self.length: raise IndexError('ArrayOffset index out of range: %r' % idx) if idx < 0: idx += self.length off = self._base + self.offset + sizeof(ttype, tver) * idx return ttype(self._buf, off, tver)
def _iteritems(self): off = self._base + self.offset sz = sizeof(ttype, tver) for i in xrange(self.length): yield ttype(self._buf, off, tver) off += sz