Passing indented code to compile()

John Wilson tug at wilson.co.uk
Wed May 7 09:07:32 EDT 2003


Yes, I think I can reasonably ask people to indent according to the Python
rules. It does not seem reasonable to ask them to start their code in the
first column of an XML document. It makes the XML look horrid.

Thanks for the response.

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

----- Original Message ----- 
From: "Harvey Thomas" <hst at empolis.co.uk>
To: "John Wilson" <tug at wilson.co.uk>; <python-list at python.org>
Sent: Wednesday, May 07, 2003 1:49 PM
Subject: RE: Passing indented code to compile()


[snip]

Assuming that you are parsing for well-formed XML, then all white space is
considered significant; hence the blank line and leading white space
before/after the print statement. If the XML document had contained

<execute globals="globals" locals="locals">print "hello"</execute>

then you wouldn't have had the problem. If the code to be compiled spans
more than one line I can see further problems though as Python's indentation
rules are going to get in the way unless the XML is very carefully
formatted.







More information about the Python-list mailing list