I think the best way to do this is

`sum(1 for i in self.top.residues())`

https://github.com/erikrose/more-itertools/blob/master/more_itertools/more.py#L201