Async Techniques and Examples in Python Transcripts
Chapter: Threads
Lecture: Concept: Tips for multiple threads

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We saw a few nice little techniques for working with sets of threads more than one thread at a time. So let's suppose that we're going to create
0:09 three threads and we want to work with them as a set. Basically we want to spin those three off and then we're going to start them
0:15 and then wait for them all to finish. So we did that in our producer consumer example while having a list of threads and we create them all
0:22 and just in line like this. We could do it in a loop. Append if you wanted. But in this case we didn't need to do that.
0:28 Next we're going to start them all using this cool little list comprehension. t.start() for t in threads. Potentially do some other work
0:36 and then wait for them to finish. So t.join() for t in threads. Pretty simple right.

Talk Python's Mastodon Michael Kennedy's Mastodon