Expert Python Tutorial #5 – Generators

///Expert Python Tutorial #5 – Generators

Expert Python Tutorial #5 – Generators

FavoriteLoadingAdd to favorites

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

By |2020-12-21T11:22:47+00:00December 21st, 2020|Python Video Tutorials|35 Comments

35 Comments

  1. Adventures with Zach December 21, 2020 at 11:22 am - Reply

    wow, how do you remember all these functions when your are teaching, i don't see any edit outs

  2. António Santos December 21, 2020 at 11:22 am - Reply

    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.

  3. GhostixMusic December 21, 2020 at 11:22 am - Reply

    I luv u bro. ♥

  4. Jose Velez December 21, 2020 at 11:22 am - Reply

    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?

  5. Mampi IARIMAMPIANINA December 21, 2020 at 11:22 am - Reply

    wow! now i understand why yield and next are so useful. that wass greatly explained

  6. BigmancozmoPlayz December 21, 2020 at 11:22 am - Reply

    thank you for your python tutorials now i know how to zip a file that the user input

  7. Adrián Vorčák December 21, 2020 at 11:22 am - Reply

    x1 = np.array(i**2 for i in range(10000))

    print(sys.getsizeof(x1))

    44 bytes

  8. Arima Kishou December 21, 2020 at 11:22 am - Reply

    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…

  9. Player 1 December 21, 2020 at 11:22 am - Reply

    You are smart and talented Tim. That is why you are so shit at explaining complex topics to python-dumb people

  10. TruthSikher December 21, 2020 at 11:22 am - Reply

    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?

  11. wiloghby December 21, 2020 at 11:22 am - Reply

    Tim is super cute!

  12. X Ray December 21, 2020 at 11:22 am - Reply

    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 😉

  13. Bara J December 21, 2020 at 11:22 am - Reply

    Thanks bro!!

  14. Bishwarup Bhattacharjee December 21, 2020 at 11:22 am - Reply

    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())

  15. Reva Revanth December 21, 2020 at 11:22 am - Reply

    Please teach some of the most used bulitin fuctions like filter map reduce zip izip nd many more

  16. Brian M December 21, 2020 at 11:22 am - Reply

    nice vid man

  17. Samuel Richard December 21, 2020 at 11:22 am - Reply

    How much time do you spend reading each day?

  18. rakomet December 21, 2020 at 11:22 am - Reply

    Too much kite

  19. FlyinSløths December 21, 2020 at 11:22 am - Reply

    Please don't tell me this is the last one, we need more

  20. adryel barros December 21, 2020 at 11:22 am - Reply

    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)

  21. Tejas Bir Singh December 21, 2020 at 11:22 am - Reply

    Tim , have you use python for programming problems and data structures?

  22. The American commies December 21, 2020 at 11:22 am - Reply

    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.

  23. Debjyoti Biswas December 21, 2020 at 11:22 am - Reply

    Amazing series, I hope there are more!

  24. Kanchi Aaje December 21, 2020 at 11:22 am - Reply

    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

  25. Gamer Strim December 21, 2020 at 11:22 am - Reply

    I think the most important and the most hard theme it is recursion.

  26. Erick Alvarez December 21, 2020 at 11:22 am - Reply

    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.

  27. ESGaming December 21, 2020 at 11:22 am - Reply

    What is a good software to edit video in Linux?

  28. 1980legend December 21, 2020 at 11:22 am - Reply

    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

  29. August Ong December 21, 2020 at 11:22 am - Reply

    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!

  30. Ayaz Abbas December 21, 2020 at 11:22 am - Reply

    Good stuff. Could you do a video on lambdas, and also coroutines?

  31. Cdt - Shane Lajeunesse December 21, 2020 at 11:22 am - Reply

    Heyy Tim! Nice vid,
    (It’s Shane btw)

  32. Hannes Thiersen December 21, 2020 at 11:22 am - Reply

    Is extending Python code with C/C++ programs considered expert Python or expert C/C++?

  33. Sa Inco December 21, 2020 at 11:22 am - Reply

    Thanks.

  34. RagHelen December 21, 2020 at 11:22 am - Reply

    Time to end this subscription.

  35. Luis Rojas December 21, 2020 at 11:22 am - Reply

    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

Leave A Comment

*