[Python-ideas] Explicit variable capture list

Chris Angelico rosuav at gmail.com
Mon Jan 25 18:52:59 EST 2016


On Tue, Jan 26, 2016 at 10:21 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> - It allows us to avoid the "default argument" idiom, in cases where we
> really don't want the argument, we just want to capture the value. There
> are a lot of functions which have their parameter list polluted by
> extraneous arguments that should never be used by the caller simply
> because that's the only way to get early binding/value capturing.
>

Can you actually name a few, please? I went digging earlier, and
couldn't find any really good examples in the stdlib - they're mostly
internal functions (underscore-prefixed) that shouldn't be being
called from outside their own module anyway. Maybe this isn't as
common an issue as I'd thought.

ChrisA


More information about the Python-ideas mailing list