[Python-3000] u'text' as an alias for 'text'?

Christian Heimes lists at cheimes.de
Thu Mar 20 21:35:54 CET 2008


Lennart Regebro schrieb:
>>  * b'' creates a str object (aka bytes in Python 3.0)
> 
> It already does that, as b'' doesn't clash with any python 2 literal,
> so that's already fixed.

I know, I've implemented the feature myself about two months ago. I 
wanted to emphasis on the fact that b'' creates a str object in 2.6 and 
a bytes object in 3.0.

>>  * 1 creates a long instead of an int
> 
> I haven't come up with any case where you need to know if it is a int
> or a long, except if you are stripping out the L from a repr. So I
> don't think it's necessary. But maybe it could be helpful?

I think it's an reasonable approach to change *all* literals to be 100% 
Python 3.0 compatible. In this particular case I'm for the everything or 
nothing approach.

>>  * 1L and u'' are invalid
> 
> That could be good, but deprecation warnings in -3 mode is enough, IMO.

When the user specifies the py3k_literal mode than 1L and u'' should 
raise a SyntaxError. I'm -0 for no error and -1 for a deprecation 
warning with -3. It'd clutter the parser and tokenizer code even more. 
The warning isn't required, too.

Christian


More information about the Python-3000 mailing list