Passing indented code to compile()

John Wilson tug at wilson.co.uk
Wed May 7 12:08:34 EDT 2003


----- Original Message ----- 
From: "Michael Chermside" <mcherm at mcherm.com>
To: <tug at wilson.co.uk>; <python-list at python.org>
Sent: Wednesday, May 07, 2003 4:56 PM
Subject: Re: Passing indented code to compile()


[snip]
> So it turns out that indenting the code in a human-readable-and-not-
> left-aligned fashion within the XML source *IS* a requirement for
> you. In that case, since the problem stems from you requiring extra
> leading whitespace, the solution is to constrain how it is permitted.
> 
> Here is one possible solution:
>          <execute globals="globals" locals="locals">
>          <![CDATA[
>              |text = """this string has five spaces
>              |     after the newline"""
>              |if i < 0:
>              |    content = currentContent + lastContent
>              |print text + content
>          ]]>
>          </execute>

Yes, that would work. I'll think some more about it.

Thanks for taking so much trouble in producing your reply!

John Wilson
The Wilson Partnership
http://www.wilson.co.uk






More information about the Python-list mailing list