intro text

BODY / DESCRIPTION / EXPLANATION

Frequently Asked Questions:

When the main program calls f() [lines 1 to 12], Python creates a new namespace for f(). Similarly, when f() calls g() [lines 4 to 7], g() gets its own separate namespace. The namespace created for g() is the local namespace, and the namespace created for f() is the enclosing namespace.

Each of these namespaces remains in existence until its respective function terminates. Python might not immediately reclaim the memory allocated for those namespaces when their functions terminate, but all references to the objects they contain cease to be valid.

A lambda function is a small anonymous function. It is a single expression anonymous function often used as In-line function.

The power of lambda is better shown when you use them as an anonymous function inside another function.

Recommended Posts:

Similar Posts

One Comment

Leave a Reply

Your email address will not be published.