[I18n-sig] Re: Python Character Model

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu, 8 Feb 2001 21:46:16 +0100


> > Move-away-from, perhaps. Outright force moving by breaking people's
> > code, no.
> 
> Guido has been very clear that breaking incorrect code is not
> necessarily a problem.

For that, a requirement is/should be that the code was documented as
incorrect (which I think was the case in the socket calls - even
though examples had it wrong).

In this case, I think the code currently clearly *is* correct. Nowhere
in the Python reference manual is using bytes > 128 in a string
declared as incorrect. Instead, the documentation says

# 8-bit characters may be used in string literals and comments but
# their interpretation is platform dependent; the proper way to insert
# 8-bit characters in string literals is by using octal or hexadecimal
# escape sequences.

So while people should be aware that their scripts many not work on
other platforms, I think they are granted permission to use that, and
can expect that this continues to work in the same platform-dependent
way in the future (if used on the same platform).

> > Many Python users won't guess the right meaning into codec, just as
> > many people won't guess what "modem" stands for - yet they are fully
> > capable of using it (despite its demodulating nature :).
> 
> You seem to agree above that file is a better name so I'm not sure why
> we're still talking about "codec"!

Because that is how it works in Python 2.0. I'm against moving
functions around like that, as this gives a clear message that
python-dev can and will break anything anytime. Please see a recent
message from Fredrik Lundh who was complaining about this very
problem: people seem to be fond of breaking other people's code "for
their own good".

> Do you have any problems with reusing open with a quasi-mandatory
> (HIGHLY RECOMMENDED!) encoding argument?

No, that is certainly better than another builtin. It'd depend on the
exact signature, though - as you point out, open has already two
optional arguments. Adding a third one won't fly; it has to be a
keyword argument, then.

Regards,
Martin