+ 1
1 Réponse
+ 3
asynchronous means the function call happens on a thread other than the main one.
for example, say you have a sims like game with characters that can perform various actions. and the player types commands to get them to do stuff. In this game you also want to carry on updating the graphics regardless of user input.
the only problem is that the input() function is synchronous (doesn't run on another thread) and will wait forever until the user eventually types something and hits enter. until such an event happens, everything in the game will just stop dead in place
the solution is to make the event loop (the part that gets user input) asynchronous, it runs on a separate thread, so you can continue updating the graphics while in the background, you're also checking what commands have been entered.