Comment on PEP 263 - Defining Python Source Code Encodings

Martin v. Loewis martin at v.loewis.de
Sat May 11 09:48:36 EDT 2002


"David LeBlanc" <whisper at oz.net> writes:

> > It is well-formed, but it is invalid - check the XML spec. It violates
> > at least one validity constraint, namely that the root element must be
> > declared.
> 
> XML is used far more often in "well formed" contexts than in "valid"
> contexts. This is hair splitting.

I just said it is "invalid XML", and that's what it is. Ask any XML
expert - they will all agree on the meaning of "valid" and "invalid"
in the context of XML.

> Let's see, you're saying here that only emacs supports it trivially: idle
> needs a patch and vim uses an alternate syntax (which, below, you say is
> broken), which isn't clearly mentioned in the PEP I believe?

It clearly is mentioned: look at the regular expression.

Also, I said (but I can repeat it here) that notepad.exe supports the
PEP trivially, as does Visual Studio .NET. I guess Microsoft Word also
supports the PEP, but few people will use it to edit Python source
code.

> Can you honestly say that this syntax offers a more flexible base
> for possible future "smart comments"?

No. I dearly hope that there won't be any further "smart comments". I
once asked for the introduction of a directive statement as proper
syntax, but that PEP was rejected.

> Actually, for something as important as encoding, I think using "smart
> comments" for a feature that is known to the compiler is a mistake and
> "pragma encoding='encoding_name'" makes far more sense

See PEP 244. Been there, done that.

Regards,
Martin



More information about the Python-list mailing list