Python: Using the send function to inject parameters into a generator

preview_player
Показать описание
It is sometimes useful to pass information into a generator in python to modify its future behavior. The send method does this. Here is a simple example.
Рекомендации по теме
Комментарии
Автор

The best video I found on this. None others spent time on explaining the actual implementation inside the generator (=)

cyclogenisis
Автор

Please keep doing these short videos (straight to the point) I love them. Thank you.

walber
Автор

Thanks! Short and concise just what I need

AsdrubalSantanderSanchez
Автор

@GerryJenkins when seq1.send(1), skip = 1. In the if statement, i += skip which is the same as i+=1. How come the next val is skipped?

ge_song