Grant Edwards <grant.b.edwa...@gmail.com>:
> IOW, you use a local function instead of a global one for the exact
> same reasons you use local "variables" instead of global ones.
>
> In Python, functions are first class objects.  Binding a name to a
> function is no different than binding it to an integer, list, string,
> or dict.  Don't the global vs. local cost vs. benefit calculations
> apply equally well to function objects as they do to those other sorts
> of objects?

Precisely!

The most important reason to use inner functions or inner classes is
that it's cromulent for the task at hand, stylistically opportune or
optimal, not to use the word Pythonic.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to