The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Python program structure
By Guest on 2nd November 2022 08:26:11 AM | Syntax: TEXT | Views: 191



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. 4.1. Structure of a program
  2. ===========================
  3.  
  4. A Python program is constructed from code blocks. A *block* is a piece
  5. of Python program text that is executed as a unit. The following are
  6. blocks: a module, a function body, and a class definition. Each
  7. command typed interactively is a block.  A script file (a file given
  8. as standard input to the interpreter or specified as a command line
  9. argument to the interpreter) is a code block.  A script command (a
  10. command specified on the interpreter command line with the "-c"
  11. option) is a code block. A module run as a top level script (as module
  12. "__main__") from the command line using a "-m" argument is also a code
  13. block. The string argument passed to the built-in functions "eval()"
  14. and "exec()" is a code block.
  15.  
  16. A code block is executed in an *execution frame*.  A frame contains
  17. some administrative information (used for debugging) and determines
  18. where and how execution continues after the code block's execution has
  19. completed.
  20.  
  21.  
  22. Related video:
  23. 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
  • Recent Pastes