Python Generators Explained

146,566
0
Published 2021-08-03
Welcome back to another YouTube video! In this video, I will be talking about generators in Python. Generators are similar to iterators but a more advanced concept in the Python language. However, they are not too complicated and anyone should be able to follow along.

💻 Thanks to HiCounselor for sponsoring this video! Apply to their next cohort to land your dream job in tech here: hicounselor.com/ HiCounsoler not only provides great learning resources but also has great interview prep material!

⭐️ Timestamps ⭐️
00:00 | Overview
01:43 | Generators vs Iterators
02:40 | Iterators Explained
08:33 | next()
13:58 | iter()
15:24 | Creating Legacy Iterators
19:22 | Creating Generators
23:15 | Generators Use Case
26:58 | Generator Comprehensions

◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰
💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p/the-fundamentals-of-…
👕 Merchandise: teespring.com/stores/tech-wit...

🔗 Social Medias 🔗
📸 Instagram: www.instagram.com/tech_with_tim
📱 Twitter: twitter.com/TechWithTimm
⭐ Discord: discord.gg/twt
📝 LinkedIn: www.linkedin.com/in/tim-ruscica-82631b179/
🌎 Website: techwithtim.net/
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim

🎬 My YouTube Gear 🎬
🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
🕹 Tripod: amzn.to/3hpSprv
🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
☀️ Lights: amzn.to/2ApeiXr
⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
📢 Speaker (Beats Pill): amzn.to/2XYc5ef
🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih

💸 Donations 💸
💵 One-Time Donations: www.paypal.com/donate?hosted_button_id=CU9FV329ADN…
💰 Patreon: www.patreon.com/techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️

⭐️ Tags ⭐️
- Tech With Tim
- Generators
- Generators Explained
- Iterators
- Python
- HiCounselor

⭐️ Hashtags ⭐️
#TechWithTim #Generators1

All Comments (21)
  • @goboy6882
    I started programming 60 years ago. Thank you Tim for teaching an old dog new tricks.
  • I very rarely leave comments on tutorials, but this was so incredibly well and robustly explained that I seriously need to leave my comment of appreciation, it was so clear to understand!
  • Thanks Tim. You have become the go-to guy when I learn stuff and get stuck. your explanations are very practical. as a new programmer who's attempting to beef up my resume, I have been teaching myself python. you have been a great resource, keep it up. THANK YOU!
  • @vinni113
    i watched this video just to learn something new about python, turns out the generator is really applicable in my code and has helped memory usage heaps. Thanks!
  • Great video and explanation! Was going to look for “how to process large amounts of data”, but clicked on this instead. Turned out to be the core of the answer👍
  • @roarba
    This channel is just so incredible! i can't tell how much i learned from this channel, thank you
  • @Factory400
    It is nice and refreshing to see a presentation of the back-end logic to the magic functions we have in Python. As much as I love the built-in functions - I really love knowing how they do what they do.
  • @fredericoamigo
    Great video! Best explanation I’ve seen so far on this topic!
  • @MissingTricks
    This video provides a clear image of how it works. Thank you.
  • Wow! This was so refreshing and highly insightful. Thanks so much Tim for this really helpful video on generators. It helped me a lot understand this better!
  • @LNMLucasMasiero
    Thanks you. This was really interesting. It's crazy how the most someone knows about how something works, then for intuition you can understand other stuff or libraries created from others. One of the usefully methods I use as a fast document of a library is "dir"
  • @ChromaDotNova
    I appreciate the video, Tim! I have a much better understanding of Python generators now.
  • @ddbarenco
    Amazing explanation! Learn a lot from it. Thank you soo much!!
  • @STFU665
    Really appreciate your videos. Thank's for sharing your knowledge. I'm just at the start with Python deep-diving, but already it keeps getting me staying awake at night. So many possibilities :D Keep on the good work <3
  • @NabeelButt
    Good thing about this video is that it walks you through other concepts too such as class and dunder methods which is kind of a good refresher to what I have studied earlier. You've earned a subscriber Tim!