

In this expert python tutorial we will be discussing generators. Generators are a way to generate sequences or values in a memory efficient way. They use the yield keyword rather than return and are useful for optimizing programs and avoiding memory issues.
⭐️ Thanks to Kite for sponsoring this video! Download the best AI automcolplete for python programming for free:
Playlist:
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
📸 Instagram:
🌎 Website
📱 Twitter:
⭐ Discord:
📝 LinkedIn:
📂 GitHub:
🔊 Podcast:
💵 One-Time Donations:
💰 Patreon:
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
⭐ Tags ⭐
– Tech With Tim
– Python Tutorials
– Python Generators
– Generators in Python
– Python Generator Tutorial
– How to Use Generators Python
⭐ Hashtags ⭐
#Python #ExpertPython
source
wow, how do you remember all these functions when your are teaching, i don't see any edit outs
Hi Tim. I'm a software tester working in automation, and having a go at intermediate level certification in Python. This is what I needed has complement to Python Institute's course. Thank you for sharing your knowledge! Greetings from Portugal.
I luv u bro. ♥
Very helpful. Thanks for sharing. Some follow up questions:
1. Would I be correct in thinking that underlying all of this is Python utilizing some sort of linked list data structure to know where it currently is within the iterable? Is that how/why the _next_ method is applied?
2. I noticed when I ran the test on size using the sys.getsizeof() method for the same size list, I got 87624 for the list and 120 for the generator. Why the difference? Does it have anything to do with 32 bit vs 64 bit systems?
wow! now i understand why yield and next are so useful. that wass greatly explained
thank you for your python tutorials now i know how to zip a file that the user input
x1 = np.array(i**2 for i in range(10000))
print(sys.getsizeof(x1))
44 bytes
Holy smokes, I copied out the code you did in the first two minutes and ran it, my computer made a noise I've never heard before…
You are smart and talented Tim. That is why you are so shit at explaining complex topics to python-dumb people
This isn't really related to generators, but why do you define a separate next method rather than just writing the code inside the dunder next method?
Tim is super cute!
You can also create asynchronous programs using generators because you can pause a function with yield and then use the send method of generators to continue execution. Not that this is insanely useful but perhaps nice to know 😉
Thanks bro!!
Consider using what is called generator expression much like list comprehension, the difference being you get a generator object instead of, well, a list. Just wrap the expression with parentheses instead of square brackets. gen=(x**2 for x in range(10000000)), print(gen.next())
Please teach some of the most used bulitin fuctions like filter map reduce zip izip nd many more
nice vid man
How much time do you spend reading each day?
Too much kite
Please don't tell me this is the last one, we need more
Another way of making a generator is by using () other then [] in the list comprehension:
a = (i**2 for i in range (100))
print(a) # < generator at…>
for i in a:
print(i)
Tim , have you use python for programming problems and data structures?
hi tim, i by no means am following this tutorial but i would like to know how to download pygame onto python 3.8 on IDLE.
Amazing series, I hope there are more!
Hello Tim.
I am learning your pygame tutorial series.I have a question.I downloaded
the sprite sheet of Itachi and i was able to move him left and right.
but i wanted to do a power attack just by pressing a key.
How can i make him to do that animation by loading images .
Please reply
I think the most important and the most hard theme it is recursion.
Totally amazing, I´m going through all of your videos bro, you de best. I´d like to know if you know about Cython, it´s off topic but I´d like to do faster programs with Cython and I was wondering if you may know. Anyways, keep your hard work, I´m following.
What is a good software to edit video in Linux?
What happens if you need to collect all the values? Do you still need the list comprehension, or can you output the generator to a list, and does that save any memory compared to the list comprehension? Thanks
Keep up the series man! I'm a college student as well and most of the time, you are one of the channel which has helped me to continue learning python and self explore projects on the side to build my portfolio!
Good stuff. Could you do a video on lambdas, and also coroutines?
Heyy Tim! Nice vid,
(It’s Shane btw)
Is extending Python code with C/C++ programs considered expert Python or expert C/C++?
Thanks.
Time to end this subscription.
As always, amazing tutorials.
Looking at the metaprograming tutorial made me question, is it possible to bring the DateTime helpers from ruby onrails to python? you can do very nice things with those, mainly for time calculation like 10.minutes.from_now or 2.hours + 20.minutew + 15.seconds