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

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

[Python-Dev] PEP 318 - generality of list; restrictions on elementsJeff Epler jepler at unpythonic.net
Mon Mar 8 16:29:54 EST 2004
In the suggested syntaxes, the modifiers are not a list.  There's no
list here:
    >>> def f() [wrapper]: pass
just like there's no tuple* in either of these (or the above):
    >>> def f(x, y): pass
    >>> class C(A, B): pass
and you can't just say
    >>> s1 = (x, y)
    >>> def f s1: pass
or
    >>> s2 = (A, B)
    >>> class C s2: pass

I don't think there'll be any trouble becoming accustomed to this new
syntax, with something "a lot like a list literal (but not quite)".

The answer to any of the specific questions you posed is answered
by the PEP's new grammar rule.  As I understand it, the items must be
callable, they may return anything, and they must take the output from
the inner modifier function (a function object in the case of the
earliest-called modifier).  For instance, the following would be
permitted (but probably not encouraged):

    >>> def call(f): return f()
    >>> def pi() [call]:
    ...     return math.atan(1) * 4
    >>> pi
    3.1415926535897931


Jeff

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