5

It seems they are providing the same function, ultimately returning a dict or item through a pipeline or feed. Is there a reason I would use one over the other?

therealbriansc
  • 75
  • 2
  • 10

1 Answers1

7

In contrast to "return", "yield" doesn't exit the function and continues with the your for-loop. If you use "return", your for-loop will finish after the first iteration.

For more information: What does the "yield" keyword do in Python?

Community
  • 1
  • 1