[Python-Dev] Python 1.7 tokenization feature request

Andrew M. Kuchling akuchlin@mems-exchange.org
Mon, 13 Mar 2000 16:23:29 -0500 (EST)

gvwilson@nevex.com writes:
>Once 1.6 is out the door, would people be willing to consider extendin=
>Python's token set to make HTML/XML-ish spellings using entity referen=
>legal?  This would make the following 100% legal Python:
>i =3D 0
>while i < 10:
>    print i & 1
>    i =3D i + 1

I don't think that would be sufficient.  What about user-defined
entities, as in résultat =3D max(a,b)?  (r=9Bsultat, in French.)=

Would Python have to also parse a DTD from somewhere?  What about
other places when Python and XML syntax collide, as in this contrived

# Python code starts here
if a[index[1]]>b:
    print ...

Oops!  The ]]> looks like the end of the CDATA section, but it's legal
Python code.  IMHO whatever tool is outputting the XML should handle
escaping wacky characters in the Python code, which will be undone
by the parser when the XML gets parsed.  Users certainly won't be
writing this XML by hand; writing 'if (i &lt; 10)' is very strange.

A.M. Kuchling=09=09=09http://starship.python.net/crew/amk/
Art history is the nightmare from which art is struggling to awake.
    -- Robert Fulford