Proposal: require 7-bit source str's

"Martin v. Löwis" martin at v.loewis.de
Thu Aug 5 17:54:03 EDT 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.

Regards,
Martin



More information about the Python-list mailing list