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/150786.html below:

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

[Python-Dev] PEP 559 - built-in noop()Barry Warsaw barry at python.org
Thu Nov 23 10:49:28 EST 2017
On Nov 22, 2017, at 19:32, Victor Stinner <victor.stinner at gmail.com> wrote:
> 
> Aha, contextlib.nullcontext() was just added, cool!

So, if I rewrite PEP 559 in terms of decorators it won’t get rejected?

from functools import wraps

def noop(func):
    @wraps(func)
    def wrapper(*args, **kws):
        return None
    return wrapper


@noop
def do_something_important(x, y, z):
    return blah_blah_blah(x, y, z)


print(do_something_important(1, 2, z=3))

Cheers?
-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171123/a60ceb7a/attachment.sig>
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