Jotting one man's journey through software development, programming, and technology
◀️ Home
yieldVery powerful and memory-efficient technique, especially for an application that handles large video files.
In Python, when you use the yield keyword in a function, you’re not creating a regular function; you’re creating a generator function.
Here’s the difference between a regular function and a generator function:
__name__ == "__main__"if __name__ == "__main__":
# the desired code
If the script is being run directly (for example, by typing python script.py in the terminal), then __name__ is set to "__main__" automatically. If the script is being imported into another script, __name__ is set to the name of the script/module (e.g., “script”).