[Python-Dev] Python FAQ: Why doesn't Python have a "with" statement?

Curt Hagenlocher curt at hagenlocher.org
Thu Jun 19 19:19:34 CEST 2008


On Thu, Jun 19, 2008 at 4:54 AM, C. Titus Brown <ctb at msu.edu> wrote:
>
> More generally, I've never understood why some people insist that
> certain features make Ruby better for DSLs -- are code blocks really
> that important to DSLs?  Or is it just the lack of parens??

Code blocks let Ruby-based DSLs "do" flow control, while the lack of
parens make ordinary method names look like keywords.  These things
are a mixed bag -- on the one hand, they can certainly make the
resulting DSL a lot easier to read.  On the other, they seem to
encourage a lot of over-the-top cleverness in terms of creating
"fluent interfaces".  I fail to see much value in being able to write
code that says "7.seconds.ago".

--
Curt Hagenlocher
curt at hagenlocher.org


More information about the Python-Dev mailing list