meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

programming:python:modules [2024/01/30 14:43] – created niziakprogramming:python:modules [2024/02/23 20:15] (current) niziak
Line 7: Line 7:
 [[https://peps.python.org/pep-0420/|PEP 420 – Implicit Namespace Packages]] [[https://peps.python.org/pep-0420/|PEP 420 – Implicit Namespace Packages]]
  
 +
 +===== __init__.py =====
 +
 +It is required to make Python tread directories as packages. It can be simply empty file.
 +This file is always executed when any part of module is imported.
 +
 +===== __main__.py =====
 +
 +Most commonly, the ''__main__.py'' file is used to provide a command-line interface for a package.
 +''__main__.py'' will be executed when the package itself is invoked directly from the command line using the -m flag.
 +[[https://docs.python.org/3/library/__main__.html#main-py-in-python-packages]]