Python Tutorial: Iterators and Iterables - What Are They and How Do They Work?

preview_player
Показать описание
In this Python Programming Tutorial, we will be learning about iterators and iterables. There is a lot of confusion around these terms and exactly what they mean. We're also going to learn how to make an object ourselves that is both an iterable and an iterator. This video isn't only about understanding these definitions. It's also about understanding the concepts of iterators so that you can write better code. Understanding these underlying concepts is going to help you write code that is more efficient and will also help you see solutions to certain problems in a way you might not have thought of before. So with that said, let's get started...

The code from this video can be found at:

Coding Problem for This Video:

Object-Oriented Series:

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python
Рекомендации по теме
Комментарии
Автор

These tutorials are epic, how can you talk 20mins without any single unnecessary word, truly amazing. Thank you so much Corey. You are my #1 Pyhton reference in my classes I teach in the collage! Keep up the great work!

erdi
Автор

Corey Schafer ... U are the only Foreign Youtube, Instructor of Python whom i Follow. Your Videos contains information multifolds 10 which we get from any other video.. I am Surprised how do u do this...You make Sound Python Like Childs Play ... Hats off to u ... Expecting Machine Learning from You. That could be the Internet Breaker Videos of Yours

mahesh_kok
Автор

Thank you, Sir. I wake up at 4 in the morning and continue watching your lessons.

ji-axinliu
Автор

Thank you for making these awesome videos!! Goal after graduation: support your channel.

shahzebafroze
Автор

Corey, you're awesome! You always make my day. Anytime I'm in need need of a lesson on any python topic, your channel is always my first port of call, to see if you have it. You always know how to make it sink in so well. Thanks

judeleon
Автор

1. In Python, an object can be called an "iterable" if it has the dunder method __iter__ which should return an iterator and an iterator is an object that has the method __next__.
2. __iter__ is a method that a python list has.
3. By performing the for loop on the list, python invokes that list's __iter__ method which returns an iterator that we can loop over.


we can do next(mylist.__iter__()) which invokes the iterator's __next__ method or call or invoke it directly: mylist.__iter__().__next__()

we can also do next(iter(mylist))

"Generators are iterators as well, but the duder iter and duner next methods are created automatically."

WaldoTheWombat
Автор

Closure and Decorator tutorial of yours was my first experience and I am telling you, you have explained it in such a good way that I cannot forget it ever. I am not being dramatic but your explanation method is magical. When I am learning any concept, there are things which are buried inside my mind and but it cannot get out because I feel confused and also nobody talking about the same or have that kind of explaining system as yours. It's like you are connected to my mind.
So, Thank You Very Much!! God Bless You!!

aman
Автор

Corey, Simply you are the best when it comes to making someone understand the concept. Unless someone understands the concept, it is very difficult to write codes that are lot efficient and at the same time very easy to understand/read. I wish everyone who makes video on programing follows a similar template for teaching. Thanks a lot.

veeplusvee
Автор

This is your first video I am watching. And this single video forced me to subscribe your channel. Great job man

beginner_bro
Автор

Oh My God....I didn't know learning python can be this addictive.... Thank you muchhhh

baqir
Автор

dude.. your voice is so distinct and your explanation is crystal clear.


if I can't find something on StackOverflow or if I'm learning a new concept in python, your channel is THE resource for me. Great content.


Thank you for keeping it free.

emmanuel
Автор

OMG! Watching since last 4.5 hours, dont know when last I have wateched videos for so long. Addictive. Corey you must be a Teacher. Thanks for such nice videos

HareshRathod
Автор

i've tried a lot of teachers in order to make progress and non of them works, you are the best sir i advise everyone want to learn python to watch your serie

halim
Автор

Thank you so much for the consistent videos and tutorials and the help that you provide for people new to this ^^

furankuraw
Автор

Correction at 1:38 Corey said "Loops aren't the only thing that we can loop over " but he meant "Lists aren't the only thing that we can loop over "

devlife
Автор

Corey, Thank you for explaining this so well and simple. I have been using both iterators and iterables for while, now it makes a lot of sense.

techcode_man
Автор

You seriously teach this stuff better than anyone I've found. Thank you so much!

feernot
Автор

Old but Gold. What an excellent explanation

Greenbay-bnyk
Автор

Precise, coherent, well articulated and well structured; good tutorial, thanks

pedrocontrerasavendano
Автор

Excellent idea with the coding problems. You never really understand something until you have to use it!

IterativeTheoryRocks
visit shbcf.ru