What's the best way of counting the number of elements in a iterable (through iteration), without storing the elements in memory?

Right now, I'm just doing `sum(1 for x in iterable)`. I was hoping to find something in `itertools`, but there doesn't seem to be anything.