Basilisk96 wrote:
Don't use a generator then. If you're going to finally return a list (and sorted does exactly that), build a list right from the start:

Good point. However, for the sake of argument, what if I removed the
sorting requirement and simply wanted the generator?

Write a generator function with the same loop and a yield.

? I usually strive
for comprehensions if a for loop can be reduced to such.

You are overdoing it, I think. Generator expressions are for saving programmer time, not machine time.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to