Pythonic way of web-programming

David Abrahams dave at boost-consulting.com
Mon Apr 21 07:02:05 EDT 2003


Ian Bicking <ianb at colorstudy.com> writes:

> On Sun, 2003-04-20 at 17:00, David Abrahams wrote:
>> I don't understand; it already *is* plain Python.  While Donovan
>> Preston and I were designing the syntax, his friend Bob was sitting on
>> the couch coding it up.
>
> Hmmm... I guess so.  I was thinking of lists following an object, but it
> actualy gets parsed as a __getitem__ with a tuple as an argument.

Yes.

>> > The use of []'s isn't really necessary, and actually the expressions
>> > could maybe be eval'd as well...
>> 
>> You've lost me here.  Lots of the "syntax" choices aren't based on
>> what's neccessary, but on what's clear and expressive.  As far as
>> "eval" is concerned, well, I'm not sure if you realize this but those
>> if_ and for_each elements are lazily evaluated.  The expression
>> creates a callable object, "template", which generates new XML.
>
> So it's not actually a Python program, it's Python syntax 

And that's different from a Python program how? <.02 wink>

> that gets evaluated by your own evaluator...?  

Basically, yes, though the evaluator might be built into the object
that gets constructed.

> I was trying to see if it could be an actual Python program, which
> would construct an object you could use later to handle the XML.

I think if you go in that direction it will end up looking much as it
does... the problem, as you say, is that code blocks are not
first-class objects in Python.  Of course, that goes even further in
the direction of lambda-expressions than we've gone already, which is
the opposite of the direction GvR has been headed.  On the other hand,
he recently started talking about adding support in the future for the
design of domain-specific languages (which this XML example was), and
I don't really see how you can do that job well without first-class
code blocks.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com






More information about the Python-list mailing list