Passing indented code to compile()

Peter Hansen peter at engcorp.com
Wed May 7 10:26:06 EDT 2003


Peter Hansen wrote:
> 
> John Wilson wrote:
> >
> > Peter Hansen wrote:
> > > 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.
> 
> The "human readable" part is covered by the fact that XML documents
> are text files, nothing more.  

Sorry, unnecessarily extreme statement...   XML does of course provide
some other aspects of its design which are intended to enhance readability.
My point is that the "readable" goal for XML is shooting at a quite
different level than the "readable" goal for Python.  XML is just trying
to be readable and editable compared to binary files.  That doesn't
necessarily involve anything like the indentation-enhanced readability
of Python.




More information about the Python-list mailing list