[Python-Dev] Re: Sets: elt in dict, lst.include

Guido van Rossum guido@digicool.com
2001年1月29日 21:06:35 -0500


This is all PEP material now. Tim, do you want to own the PEP? It
seems just up your alley!
> Cool! Can we resist adding
>> if key:value in dict
>> for "parallelism"? (I know I can ...)

That's easy to resist because, unlike ``for key:value in dict'', it's
not unambiguous: ``if key:value in dict'' is already legal syntax
currently, with 'key' as the condition and 'value in dict' as the (not
particularly useful) body of the if statement.
> > (And why didn't we think of this before?)
>> Best guess: we were focused exclusively on sequences, and a colon just
> didn't suggest itself in that context. Second-best guess: having finally
> approved one of these gimmicks, you finally got desperate enough to make it
> work <wink>.

I'm certainly more comfortable with just ``for key in dict'' than with
the whole slow of extensions using colons.
But, again, that's for the PEP to fight over.
--Guido van Rossum (home page: http://www.python.org/~guido/)

AltStyle によって変換されたページ (->オリジナル) /