A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150759.html below:

[Python-Dev] PEP 559 - built-in noop()

[Python-Dev] PEP 559 - built-in noop()Nick Coghlan ncoghlan at gmail.com
Thu Nov 23 05:35:29 EST 2017
On 23 November 2017 at 19:42, Chris Jerdonek <chris.jerdonek at gmail.com>
wrote:

> On Wed, Nov 22, 2017 at 4:32 PM, Victor Stinner <victor.stinner at gmail.com>
> wrote:
>
>> Aha, contextlib.nullcontext() was just added, cool!
>>
>
> So is this equivalent to--
>
>     @contextmanager
>     def yielding(x):
>         yield x
>
> I thought we were against adding one-line functions?
>

There's a lot of runtime complexity hiding behind that "@contextmanager"
line, so I'm open to `contextlib` additions that make it possible for
sufficiently common patterns to avoid it. (The explicit class based
nullcontext() implementation is 7 lines, the same as contextlib.closing())

After 7+ years, I'm happy that this one comes up often enough to be worth a
more obvious standard library level answer than we'd previously offered.
https://bugs.python.org/issue10049#msg281556 captures the point where I
really started changing my mind.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171123/ce3bc07e/attachment.html>
More information about the Python-Dev 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