[Tutor] Re: code blocks and output streams (Daniel Ehrenberg)

Mike Hansen mhansen at cso.atmel.com
Mon Nov 10 11:39:44 EST 2003


Generally I like to keep the presentation separate from the code and shy 
away from embedded scripting like ASP and PHP. To me, it just seems 
really messy and harder to follow. Ok, we're in HTML, oh..now we're in 
script, now back to HTML, followed by script that pumps out large chunks 
of HTML...(you get the picture)

I heard that embedded scripting can be faster and easier. Anyone know if 
there have been any studies to prove it? What's the price you pay for 
"faster and easier"? Harder to maintain? <shrug>I dunno.</shrug>

 I suppose it can be a good way to learn by writing up an engine that 
does embedded scripting.

> Subject:
> [Tutor] code blocks and output streams
> From:
> Daniel Ehrenberg <littledanehren at yahoo.com>
> Date:
> Sun, 9 Nov 2003 08:30:32 -0800 (PST)
> To:
> pytutor <tutor at python.org>
>
>
>I am trying to create a program that can have php-like
>embedding of Python in html files. First, I want to
>start out with a program that can take an html file
>with python code inside <py> tags (ie something like
><py>print 'hi'</py>). In trying to do this, I found
>two problems:  executing complex code blocks (eg ones
>that must have some indentation) and creating a new
>output stream to direct things that are printed to.
>All I know about how to do this is that the exec
>keyword should be used to execute things and that I
>should change sys.stdout to change the output stream.
>
>Daniel Ehrenberg
>
>  
>




More information about the Tutor mailing list