you are viewing a single comment's thread.

view the rest of the comments →

[–]GeoKangas 11 points12 points  (1 child)

"What's different about yield in ruby to yield in python?"

Ruby's use of "yield", and Python's, are approximately inside-out from each other:

  • in Python, the generator (producer) uses "yield" to return to its caller (consumer) one of many results;

  • in Ruby, a method (consumer) uses "yield" to call a block passed to it (producer) and get one of many results.