[Python-Dev] Definining properties - a use case for class decorators?
Phillip J. Eby
pje at telecommunity.com
Tue Oct 18 06:35:19 CEST 2005
At 08:46 PM 10/17/2005 -0700, Guido van Rossum wrote:
>Now, if I were to follow Paul Graham's recommendations strictly
>(http://www.paulgraham.com/diff.html), point 7 saysthat Python should
>have a symbol type. I've always maintained that this is unnecessary
>and that we can just as well use regular strings.
Well, unless you're going to also do #8 ("a notation for code"), I'd agree. :)
But then again, Graham also lists #6 ("programs composed of expressions"),
and even though I'm often tempted by the desire to write something as a big
expression, the truth is that most people's brains (mine included) just
don't have enough stack space for it. The people that have that much
mental stack space can already write lambda+listcomp atrocities for the
rest of us to boggle at. :)
Logix (http://livelogix.net/logix/) basically adds everything on Graham's
list to Python, and then compiles it to Python bytecode. But the result is
something that still doesn't seem very Pythonic to me.
Of course, with good restraint, it seems to me that Logix allows some very
tasteful language extensions (John Landahl created a nice syntax sugar for
generic functions with it), but making full-tilt use of Graham's 9 features
seems to result in a very Lisp-like experience, even without the parentheses.
At the same time, I would note that Ruby does seem to have an edge on
Python in terms of ability to create "little languages" of the sort that
Logix also excels at. Compare SCons (Python) with Rakefiles (Ruby), for
example, or SQLObject (Python) to Rails' ActiveRecord. In each case, the
Python DSL syntax is okay, but Ruby's is better. Even PEP 340 in its
heydey wasn't going to improve on it much, because Ruby DSL's benefit
mainly from being able to pass the blocks to functions which could then
hold on to them for later use. (Also, in an ironic twist, Ruby requires
fewer parentheses than Python for such operations, so the invocation looks
more like user-defined syntax.)
More information about the Python-Dev
mailing list