Proposal: require 7-bit source str's

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Fri Aug 6 12:09:44 CEST 2004


Martin v. Löwis wrote:
>Hallvard B Furuseth wrote:
>>>The coding declaration was only acceptable because
>>>- a statement would have to go before the doc string, in
>>>   which case it would not have been a docstring anymore, and
>> 
>> 
>> Hmm...
> 
> You misunderstood. I was talking about the module docstring
> 
> "Written by Martin v. Löwis"

So if the file has -*- coding: iso-8859-1 -*-, how does that doc string
look to someone using a iso-8859-2 locale?

I would think such doc strings should be u"""...""" strings.
(After the help function is fixed:-)

> directive encoding "utf-8"
> "Written by Martin v. Löwis"
> 
> Here, the string is not a docstring anymore, because it is
> not the first expression in the module.

Just like a str7bit directive, in whatever form, would not catch the
missing u in front of the doc string.

>> Still, how about 'directive str7bit', 'directive -W::str7bitWarning' or
>> something?
> 
> See PEP 244. I would have liked a directive statement, but the PEP was
> rejected (in favour of __future__ imports, at that time).
> 
> A future import might work, except that this is a commitment that
> the future comes some day, which, for str7bit, would not be the case:
> there will *always* be a possibility to put non-ASCII bytes into 8-bit
> strings

Yup.

> (of course, requiring that people use escape sequences for
> them might be acceptable).

Argh!  Please, no.

> In any case, you probably have to write a PEP for this.

I will.

-- 
Hallvard



More information about the Python-list mailing list