[Python-ideas] Explicit variable capture list
Sven R. Kunze
srkunze at mail.de
Mon Jan 25 16:03:50 EST 2016
On 24.01.2016 06:16, Guido van Rossum wrote:
> I wonder if kids today aren't too much in love with local function
> definitions. :-) There's a reason why executor.submit() takes a
> function *and arguments*. If you move the function out of the for loop
> and pass the url as a parameter to submit(), problem solved, and you
> waste fewer resources on function objects and cells to hold nonlocals.
> A generation ago most people would have naturally used such a solution
> (since most languages didn't support the alternative :-).
Well said.
I remember js be a hatchery of this kind of programming. My main concern
always was "how can I test these inner functions?" Almost impossible but
a good excuse not to. So, it's unprofessional from my point of view but
things may change.
On-topic: I like the way Python allows me to bind early. It's simple and
that's the main argument for it and against introducing an yet-another
syntax (like colons, brakes, etc.); especially for solving such a side
issue.
Best,
Sven
More information about the Python-ideas
mailing list