Functions

Defining and calling functions, every argument style including *args and **kwargs, scope and the LEGB rule, and lambda expressions.

4 notes

Notes

Python

Scope and the LEGB Rule

Python resolves a name by looking in four places in a fixed order: local, enclosing, global, built-in. Assignment anywhere in a function makes the nam...

Read more
Python

Lambda Functions

A lambda is a small anonymous function written as a single expression. It exists for the places where naming a function would add nothing.

Read more