human
What's the shortest way to count the number of items in a generator/iterator?
assistant
Here is some code to count the number of items in a generator/iterator `it`

sum(1 for i in it)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.