[Python-Dev] PEP 340: syntax suggestion - try opening(filename) as f:

Phillip J. Eby pje at telecommunity.com
Sat Apr 30 03:54:47 CEST 2005


At 08:21 PM 4/29/05 -0500, Ka-Ping Yee wrote:
>All the statements in Python are associated with keywords, except
>for assignment, which is simple and extremely common.  I don't
>think the block statement is simple enough or common enough for
>that; its semantics are much too significant to be flagged only
>by a little punctuation mark like a colon.

Don't forget the 'as' clause.


>I can empathize with wanting to avoid a keyword in order to
>avoid an endless debate about what the keyword will be.  But
>that debate can't be avoided anyway -- we still have to agree
>on what to call this thing when talking about it and teaching it.

A "template invocation", perhaps, for the statement, and a "templated 
block" for the actual block.  The expression part of the statement would be 
the "template expression" which must result in a "template iterator".


>The keyword gives us a name, a conceptual tag from which to hang
>our knowledge and discussions.  Once we have a keyword, there
>can be no confusion about what to call the construct.  And if
>there is a distinctive keyword, a Python programmer who comes
>across this unfamiliar construct will be able to ask someone
>"What does this 'spam' keyword mean?" or can search on Google for
>"Python spam" to find out what it means.  Without a keyword,
>they're out of luck.  Names are power.

help(synchronized) or help(retry) would doubtless display useful 
information.  Conversely, try Googling for Python's "for" or "if" keywords, 
and see if you get anything useful -- I didn't.



More information about the Python-Dev mailing list