In Python, keywords like def
, class
introduce a new scope. Others, like if
or for
do not - they use the scope of the enclosing code. (The scope resolution is explained in Short Description of the Scoping Rules? .)
What are the proper terminology for the code lines "indented under" these two, different kind of keywords?
Example:
def foo():
do_bar() # indent type 1
do_another_bar() # indent type 1
Example 2:
if True:
do_something() # indent type 2
do_more_things() # indent type 2
Are both indent "type 1" and "type 2" called "blocks" of code?