|
|
/ Hathaway Weblog / Python-Dev: Spectator Sport |
I'm getting a kick out of watching the discussions on Python-Dev, the mailing list for Python development. It's fun to see a new syntax proposal, evaluate it on my own, and try to predict the reaction by the group. Watching in real time makes it more fun.
For example, here's a syntax that was just suggested by Nick Coghlan:
def my_resource(): print "Hi!" # Do entrance code continue # Go on with the contents of the 'with' block print "Bye!" # Do exit code
The intent is to integrate this into PEP 310. The word "continue" is a very appropriate English word, and the syntax is technically unambiguous. However, there's some risk that coders will misplace the continue keyword in code not intended to be used as a resource, causing a "def" statement to surprisingly generate a resource rather than a function. My guess is that risk is not large enough to dismiss the idea, and some other risk will make it more controversial. I wonder what it will be. The level of insightfulness among the group is incredible.
Comments
Ah, here's the problem: if the continue keyword happens to be in a loop, the code becomes a normal function rather than a block handler. It would be an easy mistake. Too bad.
Someone pointed out that PEP 310 gets us fairly close to Lisp-like macros. Interesting. And I just read an article (discovered via windley.com) that suggests Python is a dialect of Lisp.
