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/2004-March/042903.html below:

[Python-Dev] Pep 318 - new syntax for wrappers

[Python-Dev] Pep 318 - new syntax for wrappers [Python-Dev] Pep 318 - new syntax for wrappersSkip Montanaro skip at pobox.com
Wed Mar 3 10:38:30 EST 2004
    Jim> (1)  Eventually, there will be another good idea.

    Jim> Therefore, we should define a general extension syntax, rather than
    Jim> a special case for this particular extension.

    Jim>     def func(args) [wrapper1, wrapper2]:

    Jim> uses up the syntax forever.

    Jim>     def func(args) mods [wrapper1, wrapper2]:

    Jim> allows later extensions like

    Jim>     def func(args) alias [wrapper1, wrapper2]:
    Jim>     def func(args) compiler_hints [wrapper1, wrapper2]:
    Jim>     def func(args) my_domain_special_use [wrapper1, wrapper2]:

I don't think the second version is needed.  Consider the compiler_hints
extension:

    def func (args) [hint1, hint2]:
        pass

    def hint1(func):
        func.hint1 = True
        return func

    def hint2(func):
        mess_with_func.func_code()
        return func

There's no requirement that the decorations have to return a different
function.  They can return the same function and just operate through side
effects on the input function.

Skip

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