This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Python syntax is not so XML friendly!
Type: enhancement Stage:
Components: Interpreter Core Versions:
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, cp1965, sjoerd
Priority: normal Keywords:

Created on 2005-02-18 15:31 by cp1965, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg54395 - (view) Author: Colbert Philippe (cp1965) Date: 2005-02-18 15:31
I want to embed python scripts into XML files.  The 
problems is depending on the XML readers's 
configuration, the space or tab characters might or 
might not be eliminated.  This is a a serious risk.  That is 
why I propose that Python/Jython allow for traditional 
Java style separators block ({ }).  This would be 
optional and would improve the flexibility of Python.  The 
programmer can always choose which style he/she 
wants to use.
msg54396 - (view) Author: Sjoerd Mullender (sjoerd) * (Python committer) Date: 2005-02-18 15:52
Logged In: YES 

I'm not in charge of the language, but I give you very
little chance that this is accepted.

The XML standard has this to say about white space:

"An XML processor MUST always pass all characters in a
document that are not markup through to the application. A 
validating XML processor MUST also inform the application
which of these characters constitute white space appearing
in element content.

A special attribute named xml:space MAY be attached to an
element to signal an intention that in that element, white
space should be preserved by applications. In valid
documents, this attribute, like any other, MUST be declared
if it is used. When declared, it MUST be given as an
enumerated type whose values are one or both of "default"
and "preserve"."

If your XML processor doesn't pass on white space in the
presence of xml:space="preserve" it is in error and you
should complain to there.
msg54397 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-02-18 21:17
Logged In: YES 

First off, this is not a bug and thus should be filed as a feature request.

Second, it will never happen.  A key benefit of Python is that it's syntax 
does not allow for much flexibility in terms of how to structure your code 
syntactically.  This makes it quite easy to read someone else's code 
regardless of what syntax style they use.

You also have problems with possible ambiguity with dicts.

In other words this is never going to happen simply because it goes 
against a basic Python tenant.

Closed as invalid.
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41598
2005-02-18 15:31:18cp1965create