List Comprehensions Enhancement

skaller skaller at maxtal.com.au
Tue Sep 21 12:27:17 EDT 1999


Hannah Schroeter wrote:

> Hello!
>
> In article <37DDA62D.84BE5083 at compaq.com>,
> Greg Ewing  <greg.ewing at compaq.com> wrote:
> >[...]
>
> >Hey, wow! And I haven't even gotten onto case statements
> >with pattern matching yet...
>
> *laugh*
>
> And soon there'll be function clauses with patterns and (pattern?)
> guards. *g*
>
> And then, Python will be assimilated by the (impure strict) functional
> world: A Scheme with gentler syntax and OO and module systems. :-)
>
> Regards, Hannah.
>
> PS: Mind the smileys!

Hmm. Something like this is planned for Viper.
No smileys.

You should note that current Python doesn't support closures,
that is, nested functions are not bound to the enclosing context.

Viper functions are.

In case you didn't know -- and hey, I didn't either until recently --
Python ALREADY has pattern matching, its just that the patterns
are simple: the only patterns recognized are

    variable-name
    tuple of pattern

For example:

    def f((x,y,z)): print x,y,z
    f((1,2,3))







More information about the Python-list mailing list