Proposal: require 7-bit source str's

"Martin v. Löwis" martin at
Thu Aug 5 23:54:03 CEST 2004

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.
> It can be used to ensure that the source file doesn't contain national
> characters that the program will treat as characters in the current
> locale's character set instead of in the source file's character set.

I doubt this helps as much as you'd like. You will need to change every
source file with that annotation. While you are at it, you could just
as well check every source file directly.

So if anything, I think this should be a global option. Or, better yet,
external checkers like pychecker could check for that.


More information about the Python-list mailing list