How To Use Threads In Python

In this video, I cover how to use Parallel Programming using Threads in Python. I utilize a class to dynamically create the Threads. Threads reduce the computation time and allow you to run multiple functions simultaneously.

Пікірлер: 7

  • @shinstorm3473
    @shinstorm34734 ай бұрын

    Great video, you helped me understand how easy and efficient threading can be. Thank you 🤙🤙🤙

  • @TaylorsSoftware

    @TaylorsSoftware

    4 ай бұрын

    Thank you for watching and I'm glad I could help! :)

  • @KinkyJalepeno
    @KinkyJalepenoАй бұрын

    Nice vid, have a sub. As a noob at python id really appreciate a vid on turning .py into an .exe for general python projects and tkinter based stuff if different. Hint hint 😊

  • @TaylorsSoftware

    @TaylorsSoftware

    Ай бұрын

    Thanks for the idea! :)

  • @compositeboson123
    @compositeboson123Ай бұрын

    omg you use arch !?

  • @compositeboson123

    @compositeboson123

    Ай бұрын

    @@TaylorsSoftware cool

  • @roelant8069
    @roelant80692 ай бұрын

    This is a very misleading tutorial, using threads in python to speed up your program is a lot more complicated than this tutorial pretends (test it for yourself, copy this program and test how long it takes to count to 1000, then add a second thread to the program that also counts to 1000 and time how long that takes, I did that and it took twice as long) When writing multi-threaded programs it is usually very important to make sure that two different threads can't work with the same variables at once (because this can cause nasty bugs) This is not necessary in Python though, because it has the Global Interpreter Lock (GIL for short), which only lets one one thread have access at the same time, preventing such bugs The downside of the GIL is that different threads will be waiting for the GIL to let them do their thing, so your program does not get any faster. There are ways in which your program can be sped up using threads, because not all operations are limited by the GIL (the numpy library for number crunching for example is mostly not affected). Threads can also be useful for handling things that would otherwise block your program (like something big being downloaded from the internet, if a separate thread handles that the entire program won't freeze up until that is done). So while threading is not useless this tutorial does not show the benefits or how to use it well at all TL;DR using threads in Python does not make your program faster in most cases and it takes a more in depth tutorial to explain when it actually does and why it does that