Hello, I am confused about the implementation of the custom iterator, you never used the __iter__ function to "initialize" the iterator as you would with the built in iter() function, and the custom __iter__ function doesnt return an iterator but an Even object. Also it compiled fine after removing the __iter__ function, i tought it was mandatory to have implemented the __iter__ function ? otherwise clear explanation
You are correct that the ___iter___ method was not called. However, in this case the ___iter___ method just returns self, so there no point in using it: the Even object is already an iterator. So what makes an object an iterator? From StackOverflow: "Being an iterator" means "having a __next__(self) method", which the Even object has.
Hello, thanks for the explanation. I have a question. In the "generators" video, you mention that the "return" statement destroys the state of the local variables whereas a yield keyword remembers the local variable state. When you instantiate an object of the class Even (numbers) in this video, and call next on this object, how does it remember the updated self.n value in the next call, if the return statement does not remember the state of the local variables? Thanks in advance.
Yeah and it annoys me. I cannot even look at the screen and focus when he talks. I mean turning left and right sometimes is fine, but the dude keeps doing it. Won't the cameraman say anything about it?
🔥 Learn Python with a more hands-on experience with Programiz PRO-interactive lessons, quizzes & challenges.
Try Programiz PRO: bit.ly/right-python
Gotta hand it to you - that was short, concise, and explained well. Thank you :)
The perfect video on Iterators exists. Thanks for the video. New sub ✌️
brother i m like 9 yr old and i only understand from ur concepts and video even not by my own father! thanks a lot... hats off to you
Hello,
I am confused about the implementation of the custom iterator, you never used the __iter__ function to "initialize" the iterator as you would with the built in iter() function, and the custom __iter__ function doesnt return an iterator but an Even object.
Also it compiled fine after removing the __iter__ function, i tought it was mandatory to have implemented the __iter__ function ?
otherwise clear explanation
You are correct that the ___iter___ method was not called. However, in this case the ___iter___ method just returns self, so there no point in using it: the Even object is already an iterator. So what makes an object an iterator? From StackOverflow: "Being an iterator" means "having a __next__(self) method", which the Even object has.
Fantastic video. I like the cadence you use to teach the concepts. Kudos.
Thanks for all your hard work - love your website and vids!
Awesome video, keep up the amazing work! :)
So easy and helpful ❤️ thank you so much ❤️
Had to download the mobile app after a quality video like this
great vid, however I've a slight misunderstanding why do we return the result in the next function and not just return result * 2
i have gone thru your website. its really nice.
hello there is a slight confusion in the init method the argument are two but while initializing it there is self.n?
great explanation
Hello, thanks for the explanation. I have a question. In the "generators" video, you mention that the "return" statement destroys the state of the local variables whereas a yield keyword remembers the local variable state. When you instantiate an object of the class Even (numbers) in this video, and call next on this object, how does it remember the updated self.n value in the next call, if the return statement does not remember the state of the local variables? Thanks in advance.
This it's a great explanation, you are amazing
Thank you! 😃
in a loop can you just use enumerate ? for i , v enumerate(things) i will keep track of the loop counts
nice explaing bro
Thanks for this video.. very helpful..
Superb
with dir(numbers) we can see methods in a module. How to see the code of that method. Is there any way to see code of __iter__ method
U can't see the code using dir. For that u need to refer to official documentation. In python, most of the inbuilt functions r written using C.
Will you teach us about multi-threading or multi-processing? :D
Thumbnail 🔥😆
Nice explanation
The mobile App is unbelievably amazing.
You are just too good ;-;
Every time new thigs avalabe this chhanel
Lost from self.n might need to to to Class lesson?
a python god
First here
Honestly i don't know how can i use this in my program.
Good explanation but you move your head alot
left, right, left, right, left, right.... :D
@@DomUnseen Lol yh, it hurt head
Yeah and it annoys me. I cannot even look at the screen and focus when he talks. I mean turning left and right sometimes is fine, but the dude keeps doing it. Won't the cameraman say anything about it?