Priceless video, I didn't even know about this, thanks!
@TechWithNader Жыл бұрын
You’re welcome! I was worried it would be too intense haha!
@XanEli1 Жыл бұрын
It's a little more advanced than most of the other stuff covered so far, but it's not out of reach.
@644sixfortyfour4 Жыл бұрын
I jumped back to this video as I really had no idea what generators are or where can they be useful. Going through this video alone, I can see myself using them as they can be really handy. Glad there are even more videos about generators , thank you very much Nader. 😁
@TechWithNader Жыл бұрын
Awesome, nice work! I can’t wait to use them more practically as we build more complex projects as well as look at how they are used in Classes 😊
@644sixfortyfour4 Жыл бұрын
@@TechWithNader Those will be videos I'll be looking forward to then. 😉
@KRAKENBACK.. Жыл бұрын
It seems like generators are a very powerful way to pull values whenever specifically needed, and save on tons of memory.
@TechWithNader Жыл бұрын
Yup exactly! It's tricky to use them for things other than iterators to start however it's important to be aware of the concept of 'lazy evaluation'. In fact, as you'll see later, async/await is actually based on this concept internally 😊
@vikaswakde-dj2dw8 ай бұрын
Congrat's on 10K
@senniagordinskaya40513 ай бұрын
Thank you!
@KRAKENBACK.. Жыл бұрын
Another question lol I'm back again rewatching and thought when we create the infinite loop for lazy evaluation and create our countergenerator = counter(); couldn't you have multiple countergenerators(1,2,3 ect) that save on memory, since it's a object could you add more properties in this object to x amount of different objects, and depending on the objects they could represent different things. My main question is what type of objects/concepts can we create with this in real world settings because it seems like a very efficient way to produce values.
@TechWithNader Жыл бұрын
Good question! In the real world this is used a lot to implement lazy evaluation code like something called the Observer pattern. It’s also used to make Iterators a lot. We actually explored only half of generators since you can also provide inputs to them so they are essentially no-directional pauseable functions. Also, concepts like async and await are based on them. For now just being aware of lazy evaluation and that they exist will be important as we move forward. 🤗