[Python-ideas] Statements vs Expressions... why?
cliff at develix.com
Sun Sep 14 22:47:20 CEST 2008
On Sun, 2008-09-14 at 13:02 -0700, Cliff Wells wrote:
> On Sun, 2008-09-14 at 12:36 -0700, Josiah Carlson wrote:
> > Agreed. For all of the semantic and syntactic gymnastics and
> > discussion about how statements -> expressions would make Python a
> > better language, all I can conclude from the above is "I'm glad Python
> > doesn't do that."
Using Breve as an example again: by your reasoning, the mere existence
of Breve should be reason enough not to support OO in Python (or at the
very least, magic methods).
Breve more or less a functional DSL that barely resembles Python but
actually *is* Python (in fact, I've seen someone assert that Breve
templates could not possibly be actual Python code). Even you were
initially convinced that I was doing code-generation. Breve abuses
classes and magic methods (albeit in an entirely legal way) to create
the illusion of a declarative DSL. Clearly I think this ability is a
good thing, but it could also be argued that what I've done is
inscrutable and this type of code should not be allowed in Python.
In fact, your own example of mimicking a dispatch "table" with a class
is arguably object abuse. Personally I don't think it's a bad solution
(especially in the absence of a better way), but you've basically mapped
what is logically a functional problem onto an object. My point is that
just because something *can* be abused, it isn't reason to throw the
baby out with the proverbial bath water. The more general a tool is,
the more able it is to be used incorrectly (as anyone who's pried a lid
off a can of paint with a screwdriver can attest).
More information about the Python-ideas