It would be more Pythonic to define `__len__(self)` here.