r/Python • • Mar 22 '21

Tutorial Best answer to what does yield do

https://stackoverflow.com/a/47285378/7301792
16 Upvotes

10 comments sorted by

View all comments

30

u/vanatteveldt Mar 22 '21

Comparing to return which runs once and stops, yield runs times you planed.

That's the best answer? Really? :)

And the next sentence is another gem:

You can interpret return as return one of them, and yield as return all of them. This is called iterable.

What does that even mean??

25

u/[deleted] Mar 22 '21

It means, "I know neither English, nor python, but I'm answering anyway."

1

u/throwwwawytty Apr 04 '21

This is called iterable.

-5

u/dstark1993 Mar 22 '21

By his name (Slawomir Lenart) you can clearly see that English is not his main language, the explanation was pretty good (talking as a beginner)

1

u/vanatteveldt Mar 22 '21

Sure, and neither am I (as you could guess from my username). But in programming it's very important to be exact in definitions and terminology, so sentences like above are not just me picking on a non-native, they actually clutter the learning process.