Passing indented code to compile()

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


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3EB90A51.787570E8 at engcorp.com...

[snip]


> What you're faced with is, in effect, broken Python code.  Why not
> just stop creating files with the bad/unnecessary indentation?
>
> (I assume this code is created manually, because if it was written
> out by some automated process, the tool that did it is broken and
> should be fixed.  It looks like it was written by hand, with aesthetics
> in mind.  As Harvey points out, this kind of thing is not how XML
> (or Python!) was intended to be used.

XML is intended to be human and machine readable. So we try hard to allow
XML documents to be easily understood by humans as well as by machines. Most
people find indentation in XML documents an aid to comprehension. The
alignment of begin and end tags is particularly useful.

Personally I find:

        <execute globals="globals" locals="locals">
        <![CDATA[
            if i < 0:
                content = currentContent + lastContent
            print text + content
        ]]>
        </execute>

easier on the eye than:

        <execute globals="globals" locals="locals"><![CDATA[if i < 0:
    content = currentContent + lastContent
print text + content]]></execute>

YMMV, of course.


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







More information about the Python-list mailing list