reading-notes

This Repo required for Asac labs class 2


Project maintained by ManarAbdelkarim Hosted on GitHub Pages — Theme by mattgraham

Readings: Game of Greed 2

Python Scope & the LEGB Rule:

Names and Scopes in Python

Python is a dynamically-typed language, variables in Python come into existence when you first assign them a value

Using the LEGB Rule for Python Scope

The local scope or function scope is a Python scope created at function calls.

Enclosing or nonlocal scope is observed when you nest functions inside other functions.

From the moment you start a Python program, you’re in the global Python scope. Internally, Python turns your program’s main script into a module called main to hold the main program’s execution. The namespace of this module is the main global scope of your program.

scope is a special Python scope that’s created or loaded whenever you run a script or open an interactive session.