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!!
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
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."
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.
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.
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
Ur videos are awesome Corey I have been watching all ur videos... please make an video on SYS module as well as XML parsing...I have got bunch of videos from you tube none other videos are up to the mark as u...ur explanation in any concept is at peeks no body beats u... thanks a lot
You're definitely the best python instructor on TH-cam by far...But some of us will appreciate it you could maximise the screen size we can clearly see instead of straining our eye which is probably not the best. Thank you
thank you so much for this video. I've been queering bing chat and bard chat for a couple of hours on the iterable and iterator topics but none of them managed to explain the stuff to me in a so clear way that you did.
At first i was totally scared of iterators. Next i took a study and understood how do they work and why they are used. Next i wrote some iterators and generators on my own. Then i got a question about iterators on job interview and i was one of few people who actually answered the question (as they said later). Now i really love this feature of python and this is kinda future of it because whole async thing is based on yield thing. Thank you for videos! I continue to learn a lot from you!
good_tutor = "Corey Schafer" while True[good_tutor]: next(good_tutor) #looping forever sir thanks for expensive, but free endless knowledge. go beyond.
looks I found this bit late since this was published but trust me Your are the Best . I have gone through so many videos but the way you explain and demonstrate is AWESOME!! Keep it up :) All the best...
very good explanation in this and generators video (also watched your other videos) - thanks to Corey coming from old languages like Fortran, Cobol, Pascal and I just began learning python 3 months ago and this videos helped me a lot to get a basic knowledge
So, weird moment for me. I like to go back over the parts where my ADHD started to go crazy, and when you said "Now remember I said iterators are objects with a state that..." is when I went to back up a few minutes to get back on track. When I randomly let go, you said "iterators are objects with a state that...", so I weirded out and instantly now remember this rule. I have absorbed your power. There can only be One.
Great video, but I don`t quite get one thing. It seem that at 14:30 when you use a for loop on new object *__next__()* method is somehow called. But there is no reference to it anywhere in the class *Myrange* you`ve just created. I suppose that *__iter__()* method somehow calls it, but how does it exactly work?
From the time you mentioned the never ending generator and iterators not being able to be recalled it reminded me of a database auto-increment field. Just waiting for the timeseries MatplotLib video.
for anyone who doesnt understand why he keeps saying "dunder" before each method names , he means to say "DOUBLE UNDERSCORE" iter,next,etc *basically instead of saying "DOUBLE UNDERSCORE" each time, he says "dunder" , since its easier to say* *D-UNDER* ===> Double UNDERscore
Many thanks. Two questions: 1) If we create a class that is a subclass of, say, the List class, we will inherit List's dunder methods, right? So we won't have to manually add __iter__ and __next__ ourselves? and 2) Do you run your narration through some kind of audio speed changer or do you just drink a quadruple espresso before you record?
1) That is right, it would inherit those methods. 2) I’m a fast talker haha. Surprisingly, this is me talking on Chamomile tea, so I don’t wanna hear myself after some espresso shots
I am puzzled as to why the __next__ method works. If I'm at the second to last element the 'current' variable in the __next__ method will take its value. Then what is incremented is self.value, so for the method to work, I understand that 'current' is actually a reference to self.value, and not a hard copy. Thus when incrementing self.value, current is also incremented. If that is so, I wonder if it would be clearer to just increment self.value and then return it already incremented.
Nice video Just out of curiosity, how does an iterable object which isnt a iterator work(since it wont be having the next method in its class definition work).
Why put a square bracket on the instance around dev_1 ([dev_1]) when pass to mgr_1? I try to remove it but receive a error that TypeError: argument of type 'dev_1 is not iterable. Can help to explain in more detail? Thx!
when i add that code in iDLE it comes back with Traceback (most recent call last): File "C:/Users/lesli/AppData/Local/Programs/Python/Python311/aaa.py", line 10, in print(num) NameError: name 'num' is not defined. Did you mean: 'nums'? any particular reason why?
You said you will make your own iterator, but you went on to use built in __next__ method within the class (myRange). How is that making your own iterator? I tried changing function name from __next___ to something else like 'new' and it won't work.
Yes, ranges are non-inclusive on the upper number in Python. There are several reasons for that, but a bit too much to put into a comment. You can search why and find a lot of reasoning behind it.
best python instructor ever
True
While True:
100% True
I couldn’t agree more.
HardCore my thoughts exactly!
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!!
Thanks! Glad to hear that
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
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."
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.
Oh My God....I didn't know learning python can be this addictive.... Thank you sooooooooooooooo muchhhh
This is your first video I am watching. And this single video forced me to subscribe your channel. Great job man
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.
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.
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
Ur videos are awesome Corey I have been watching all ur videos... please make an video on SYS module as well as XML parsing...I have got bunch of videos from you tube none other videos are up to the mark as u...ur explanation in any concept is at peeks no body beats u... thanks a lot
Thank you for making these awesome videos!! Goal after graduation: support your channel.
Did you by now :D
Precise, coherent, well articulated and well structured; good tutorial, thanks
Old but Gold. What an excellent explanation
You're definitely the best python instructor on TH-cam by far...But some of us will appreciate it you could maximise the screen size we can clearly see instead of straining our eye which is probably not the best. Thank you
thank you so much for this video. I've been queering bing chat and bard chat for a couple of hours on the iterable and iterator topics but none of them managed to explain the stuff to me in a so clear way that you did.
At first i was totally scared of iterators. Next i took a study and understood how do they work and why they are used. Next i wrote some iterators and generators on my own. Then i got a question about iterators on job interview and i was one of few people who actually answered the question (as they said later). Now i really love this feature of python and this is kinda future of it because whole async thing is based on yield thing.
Thank you for videos! I continue to learn a lot from you!
You have a very clear teaching style - a very valuable talent to have!
Just half done with the video and just want to say WOW!!! Corey, try writing your own python book.
good_tutor = "Corey Schafer"
while True[good_tutor]:
next(good_tutor)
#looping forever sir thanks for expensive, but free endless knowledge. go beyond.
looks I found this bit late since this was published but trust me Your are the Best . I have gone through so many videos but the way you explain and demonstrate is AWESOME!! Keep it up :) All the best...
Thanks for the straightforward and non-verbose explanation!
One of the best explanations on iterators. Thanks a ton!
It really sums up the concepts in a concise but precise way.
Thank you a lot for this!
explaining each and every steps. where were you before. please do not leave this way of teaching. we beginners needs you
very good explanation in this and generators video (also watched your other videos) - thanks to Corey
coming from old languages like Fortran, Cobol, Pascal and I just began learning python 3 months ago and this videos helped me a lot to get a basic knowledge
My search ends here. Excellent explanation
Classes in school should be like this a hyperlink to what you dont understand included. 💯
Thank you so much Corey, much appreciated how helpful this(these) videos are, just thank you 👍
Excellent video. Thank you! You are my favorite programing(python) teacher.
Corey I am big fan of you videos, kindly post the video on pytest
Super, very useful lesson. Great stuff in a shortest possible time. Thanks a lot.
Many thanks man! You are truly great at teaching! Please continue with this awesome work
Great Python Iterators and Iterables Tutorial. Thank You.
So, weird moment for me. I like to go back over the parts where my ADHD started to go crazy, and when you said "Now remember I said iterators are objects with a state that..." is when I went to back up a few minutes to get back on track. When I randomly let go, you said "iterators are objects with a state that...", so I weirded out and instantly now remember this rule. I have absorbed your power. There can only be One.
Thank you, you are great instructor. These videos are awesome and have helped me so much. I will make a contribution when I get hired soon!
A video on unit testing iterables, generators, and, unit testing functions that consume iterable objects would be great.
This video is amazing! Your teaching skills are top
Great video, but I don`t quite get one thing. It seem that at 14:30 when you use a for loop on new object *__next__()* method is somehow called. But there is no reference to it anywhere in the class *Myrange* you`ve just created. I suppose that *__iter__()* method somehow calls it, but how does it exactly work?
Thank you for this video. It is pretty clear and to-the-point. Well done.
This video is pure gold!
Thanks a ton ... your way of teaching is one of the best , please keep on posting tutorials on pandas and Numpy or any advanced python topics , thanks
Very plain and well explained. Thank you Corey, subbed.
From the time you mentioned the never ending generator and iterators not being able to be recalled it reminded me of a database auto-increment field.
Just waiting for the timeseries MatplotLib video.
Thank you for such a profound explanation!
Excellent explanations are always!!
Your lectures are amazing! Thank you so much for this!
Great Tutorial
finally i can try to understand why for loop is different from while loop. thanks
Great video as always!
Btw, I think you meant 'generator' instead of 'iterator' at 20:12 when you talked about memory effeciency.
for anyone who doesnt understand why he keeps saying "dunder" before each method names
, he means to say "DOUBLE UNDERSCORE" iter,next,etc
*basically instead of saying "DOUBLE UNDERSCORE" each time, he says "dunder" , since its easier to say*
*D-UNDER* ===> Double UNDERscore
you are making me clear things up. I gave a like and subscribed to your channel.
Corey you are the best.
Amazing lecture!Very informative!Already subscribed after seeing this one.
Holy shit, even a summary at the end! Can a tutorial get any better than this?
Thank you, man! Very clear and concise.
this guy's a genius
Thanks Corey you delivered as usual.
Simply the best!
Cheers man, this was extremely useful piece of content!
You are simply amazing ❤
You are a king man!
Thank you.
fantastic teacher
Very nice Corey! Thank you!
Beautiful! Corey you da man!
You are the best
Thank you , you’re the goat
thank you very clear your explanation
Nice Explanation
thanks so much, great explaination
Great explanation
May I ask why then iterable exists if we are have to use iter() to turn it into an iterator for it to be useful.
Thanks Corey!!
Many thanks. Two questions: 1) If we create a class that is a subclass of, say, the List class, we will inherit List's dunder methods, right? So we won't have to manually add __iter__ and __next__ ourselves? and 2) Do you run your narration through some kind of audio speed changer or do you just drink a quadruple espresso before you record?
1) That is right, it would inherit those methods. 2) I’m a fast talker haha. Surprisingly, this is me talking on Chamomile tea, so I don’t wanna hear myself after some espresso shots
Thanks for the awesome video.
How do you make your terminal clutter free like that?
This guy is amazing. why Corey why. why you stopped uploading videos.
I am puzzled as to why the __next__ method works. If I'm at the second to last element the 'current' variable in the __next__ method will take its value. Then what is incremented is self.value, so for the method to work, I understand that 'current' is actually a reference to self.value, and not a hard copy. Thus when incrementing self.value, current is also incremented. If that is so, I wonder if it would be clearer to just increment self.value and then return it already incremented.
How many Iterables can be ran on the background? Would that produce different variables on the original list?
Love the idea of a password bruteforcer .
Please make a video on it
Nice video
Just out of curiosity, how does an iterable object which isnt a iterator work(since it wont be having the next method in its class definition work).
For the longest time, I thought it was "irritable" and "irritater". ;-)
LOL
why did you define __iter__ function inside the class MyRange@13:23??
isn't the __iter__ function a defined magic method already defined in Python??
great material
thanks corey
لقد تعلمت منك كثيرا,,, أسأل الله أن يشرح صدرك للإسلام ويدخلك الجنة.
Thanks Corey
nice tutorial!
good, thanks.
Really thank you
Why put a square bracket on the instance around dev_1 ([dev_1]) when pass to mgr_1? I try to remove it but receive a error that TypeError: argument of type 'dev_1 is not iterable. Can help to explain in more detail? Thx!
when i add that code in iDLE it comes back with Traceback (most recent call last):
File "C:/Users/lesli/AppData/Local/Programs/Python/Python311/aaa.py", line 10, in
print(num)
NameError: name 'num' is not defined. Did you mean: 'nums'? any particular reason why?
Just amazing
Awesome
Very nice explanation
very complicated concept
You said you will make your own iterator, but you went on to use built in __next__ method within the class (myRange). How is that making your own iterator? I tried changing function name from __next___ to something else like 'new' and it won't work.
Awesome videos. I’m learning a lot to get proficient with Python. One minor question, why do your 1-10 list stop at 9? Is that by design?
Yes, ranges are non-inclusive on the upper number in Python. There are several reasons for that, but a bit too much to put into a comment. You can search why and find a lot of reasoning behind it.
Great. Will do! Thanks!
Awesome!
Great