Python Yield Vs Return Example

preview_player
Показать описание
Python Yield Vs Return Example
Last video we saw what the yield keyword does and how to use it.
But what actually is the use of it and why you will choose to use yield over return where you get the whole list back to work on?

Well one of the main reasons is memory usage. Yield is very memory efficient and we will see that in this video.

Follow our socials to be updated with our videos:
Рекомендации по теме
Комментарии
Автор

Having checked this video I still had a lot of questions. Maybe more then what I started with.

For other viewers: I suggest checking out the youtube video "Python Generators | Yield vs Return | Advanced Python | Tutorial 21", this gives more info on use cases, pros & cons.
Main takeaway: it IS NOT ONLY A MEMORY THING, what this video may seem to suggest.

Winkeltje
Автор

hi, i have encounter an issue. When I'm trying to watch your video on 480p or 1440p or 2160p the display of my screen is having some trouble. It seems like some green and grey horizental stripes on the screen. However if i try to run the video on 720p or 1060p this error / bugg don't come up.
Does anyone know from where is this come from and how can i fix it?
(It only happens really rarely in some of the videos but still annoying)

_Moonlight_