Writing our own Generator - Intermediate Python Programming p.9

Channel:
Subscribers:
1,410,000
Published on ● Video Link: https://www.youtube.com/watch?v=PewCyZSrnOI



Duration: 11:08
34,031 views
596


Welcome to part 9 of the intermediate Python programming tutorial series. We're going to be revisiting the topic of generators again. In the previous generators tutorial, we simply wrote generator expressions, which is a "lazy" way to work with generators.

In many cases, you really don't need to actually write a generator over just writing a generator expression. It's also more Pythonic to go ahead and just write the generator expression since it's simpler. That said, you should still know how to write a generator, since it will give you a bit more insight into how generators work, and what iterable objects really are, since, despite looking a lot like list comprehension, generators are very unique in how they act. Also, you will want to be able to know a generator when you see it.

https://pythonprogramming.net
https://twitter.com/sentdex
https://www.facebook.com/pythonprogramming.net/
https://plus.google.com/+sentdex







Tags:
generator
writing
python
python 3
tutorial
intermediate
introduction
programming