- 4.1. Structure of a program
- ===========================
- A Python program is constructed from code blocks. A *block* is a piece
- of Python program text that is executed as a unit. The following are
- blocks: a module, a function body, and a class definition. Each
- command typed interactively is a block. A script file (a file given
- as standard input to the interpreter or specified as a command line
- argument to the interpreter) is a code block. A script command (a
- command specified on the interpreter command line with the "-c"
- option) is a code block. A module run as a top level script (as module
- "__main__") from the command line using a "-m" argument is also a code
- block. The string argument passed to the built-in functions "eval()"
- and "exec()" is a code block.
- A code block is executed in an *execution frame*. A frame contains
- some administrative information (used for debugging) and determines
- where and how execution continues after the code block's execution has
- completed.
- Related video:
- Python HOW TO structure a Beginner OR Advanced Projects
Python software and documentation are licensed under the PSF License Agreement.
Starting with Python 3.8.6, examples, recipes, and other code in the documentation are dual licensed under the PSF License Agreement and the Zero-Clause BSD license.
Some software incorporated into Python is under different licenses. The licenses are listed with code falling under that license. See Licenses and Acknowledgements for Incorporated Software for an incomplete list of these licenses.
Python and it's documentation is:
Copyright © 2001-2022 Python Software Foundation. All rights reserved.
Copyright © 2000 BeOpen.com. All rights reserved.
Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved.
Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
See History and License for complete license and permissions information:
https://docs.python.org/3/license.html#psf-license