[Python-Dev] future_builtins

Eric Smith eric+python-dev at trueblade.com
Sat Feb 23 20:34:23 CET 2008


Guido van Rossum wrote:
> On Sat, Feb 23, 2008 at 9:01 AM, Eric Smith
> <eric+python-dev at trueblade.com> wrote:
>> Guido van Rossum wrote:
>>  > I don't think a -3 warning for oct or hex would do any good.
>>
>>  I'm curious as to why.  oct and hex have different behavior in 3.0,
>>  which is what I thought -3 was for.  hex might be overkill, as the only
>>  differences are the "L" and the __hex__ behavior.  But oct is always
>>  different.
> 
> Well, yeah, but what are you going to do about it? Not use oct()? I
> expect that *most* programs using oct() or hex() will work just as
> well under 3.0; typically the output is just printed, not parsed or
> otherwise further processed.
> 
> I think -3 should only warn about things where it's easy to modify the
> code so that it continues to work under 2.6 but will also work under
> 3.0. Forcing people to use "%o" just to get rid of the warning doesn't
> make sense to me.
> 

My thinking wast that using code that run under -3 without warnings 
would work exactly the same under 3.0, after running through 2to3.  So 
if oct() gave me a warning, I'd switch to the future_builtins version, 
and do whatever it took to get my program running again under 2.6 (which 
might involve not caring that the output changed from 2.5 to 2.6). 
Maybe it's wishful thinking.  I'm not too worried about this specific 
case, either.




More information about the Python-Dev mailing list