[Python-ideas] 'where' statement in Python?

Nick Coghlan ncoghlan at gmail.com
Wed Jul 21 00:13:29 CEST 2010


On Wed, Jul 21, 2010 at 6:13 AM, Alex Light <scialexlight at gmail.com> wrote:
>
>
>
> MRAB wrote:
>
>> Why use 'as'? Why not:
>
> i would use as because this whole where clause acts very similarly to a
> context manager in that it sets a variable to a value for a small block

No, the idea is for the indented suite to be a perfectly normal suite
of Python code. We want to be able to define functions, classes, etc
in there. Inventing a new mini-language specifically for these clauses
would be a bad idea (and make them unnecessarily hard to understand)

For the record, I've updated the PEP* based on the discussion in this
thread (I switched to "given" as the draft keyword due to the
Haskell/SQL semantic confusion for the "where" keyword - we've had
that discussion before, I just forgot about it last night when putting
the PEP together)

*Diff here: http://svn.python.org/view/peps/trunk/pep-3150.txt?r1=82992&r2=83002

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list