for i in range(10):
Was playing around with python simply because i am bored. I discovered the keyword yield. Which is a Simple Generator in Python. Which is in PEP 255.
For information, generator is a type of routines that can be used to control a loop. Instead of having a function that return the whole list or array. You can yield it one by one, using the yield keyword. As the function above.
With the function above, you can.
for i in even():
While the second one will ends with the error. I should find out what is the handler for the exception.
I think it is pretty cool. But really I still trying to figure out what i can use this for.