The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Python Builtins - Magic Methods - Making Python builtins work with your classes
By Guest on 3rd November 2022 04:55:38 PM | Syntax: PYTHON | Views: 205



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. 4.2. Naming and binding
  2. =======================
  3.  
  4. 4.2.3. Builtins and restricted execution
  5. ----------------------------------------
  6.  
  7. **CPython implementation detail:** Users should not touch
  8. "__builtins__"; it is strictly an implementation detail.  Users
  9. wanting to override values in the builtins namespace should "import"
  10. the "builtins" module and modify its attributes appropriately.
  11.  
  12. The builtins namespace associated with the execution of a code block
  13. is actually found by looking up the name "__builtins__" in its global
  14. namespace; this should be a dictionary or a module (in the latter case
  15. the module's dictionary is used).  By default, when in the "__main__"
  16. module, "__builtins__" is the built-in module "builtins"; when in any
  17. other module, "__builtins__" is an alias for the dictionary of the
  18. "builtins" module itself.
  19.  
  20. Magic Methods - Making Python builtins work with your classes
















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