A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2003-September/201151.html below:

Coding Style: Defining Functions within Methods?

Coding Style: Defining Functions within Methods? Coding Style: Defining Functions within Methods?JCM joshway_without_spam at myway.com
Sun Sep 7 04:11:15 EDT 2003
Bengt Richter <bokr at oz.net> wrote:
> I like defining nested functions except for the fact that a definition is executable code
> in itself, and will be re-executed each time the outer function or method is called. I'm
> not sure how long MAKE_FUNCTION or MAKE_CLOSURE take to execute, but IWT it must mean allocating
> and glueing together the dynamic elements necessary for a distinct function/closure instance,
> and then disposing of them at some point on/after their going out of scope, vs. e.g. just locating
> a sibling method.

This doesn't need to be slow--it's up to the implementation to try
to be as smart as possible.  A compiler can do lambda-lifting to
transform a program with nested functions to one without, so there
really is nothing inherently slow about nested functions.


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4