Proposal: require 7-bit source str's

Hallvard B Furuseth h.b.furuseth at
Thu Aug 5 23:53:41 CEST 2004

Peter Otten wrote:
>Hallvard B Furuseth wrote:
>> Now that the '-*- coding: <charset> -*-' feature has arrived,
>> I'd like to see an addition:
>>   # -*- str7bit:True -*-
>>   After the source file has been converted to Unicode, cause a parse
>>   error if a non-u'' string contains a non-7bit source character.
> Could
> # -*- coding: ascii -*-
> be sufficient?

No.  It would be used together with coding: <non-ascii charset>.  The
point is to ensure that all non-ASCII strings are u'' strings instead
of plain strings.

> Why would you reintroduce ambiguity with your s-prefixed
> strings?

For programs that work with non-Unicode output devices or files and
know which character set they use.  Which is quite a lot of programs.

> The long-term goal would be unicode throughout, IMHO. 

Whose long-term goal for what?  For things like Internet communication,
fine.  But there are lot of less 'global' applications where other
character encodings make more sense.

In any case, a language's both short-term and long-term goals should be
to support current programming, not programming like it 'should be done'
some day in the future.


More information about the Python-list mailing list