[Python-3000] Support for PEP 3131

Ka-Ping Yee python at zesty.ca
Tue Jun 12 09:40:29 CEST 2007


On Tue, 12 Jun 2007, Stephen J. Turnbull wrote:
> It seems to me that rather than *impose* restrictions on third
> parties, the sensible thing to do is to provide those restrictions to
> those who want them.

Hang on a second.  No one is *imposing* new restrictions.  Python
uses ASCII-only identifiers today and has always been that way.
The proposed change is to *expand* the identifier character set,
and some of us want to have control over this expansion.

> But I see no reason why that auditor program can't be run as a PEP 263
> codec.  AFAICS, the following objections could be raised, and answered:

The big missing concern from your list is that the vast majority
won't *know* that the character set is changing on them, so they
won't know that they need to do any of these things.

> 1.  PEP 263 codecs delegate the decision to the code's author; an
>     auditor shouldn't do that.

I'd be okay with this if the rules were adjusted so the codec
declaration was guaranteed to occur within a small bounded region
at the beginning of the file (e.g. the first two lines or first
80 characters, whichever is less) and that region was required to
be in ASCII.  Then you can easily know reliably, and at a glance,
what character set you are dealing with.

> 2.  The auditor would have to duplicate the work of the parser, and
>     might get it wrong.
> 3.  Parsing is expensive in time and other resources.

Both of these come down to the wastefulness of redoing something
that the Python interpreter itself already knows how to do very
well, and is, in some sense by definition, the authority on how
to do it correctly.


-- ?!ng


More information about the Python-3000 mailing list