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

[Python-Dev] PEP 318 - generality of list; restrictions on elements

[Python-Dev] PEP 318 - generality of list; restrictions on elements [Python-Dev] PEP 318 - generality of list; restrictions on elementsBernhard Herzog bh at intevation.de
Tue Mar 9 05:01:21 EST 2004
Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> To allow for dynamic insertion of a sequence of wrappers, I can
> think of two possibilities:
>
> (A) Allow a list or tuple of further items to be used as an item.
>
> (B) Allow a '*' before an item to mean that the item is to
> be treated as a sequence of items to be iterated over.

(C) Define a function that takes a sequence of decorators and returns a
decorator that applies all decorators.

E.g.

def decorators(decs):
    def apply_decorators(f):
        for d in decs:
            f = d(f)
        return f
    return apply_decorators

def f(x) [decorators([foo, bar])]:
    pass


This scheme would have the advantage that it doesn't require any
additional syntax.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/

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