Ethan Furman added the comment:

I think the code-breakage issue is that although this is a bug now, it did not 
use to be a bug.  (Or maybe it was always a bug, but nobody noticed -- I don't 
know when hex() and oct() were introduced.)

Basically, having %o and %x work with floats was the intended behavior, as 
there were tests to make sure it worked.

But hex() and oct() were designed to only work with integer types, resulting in 
two ways to get an octal or hexadecimal string, one of which worked with 
non-ints, and one which didn't.

tarfile.py, for example, was using %o to convert a stat member (a timestamp?) 
from int/float to octal.

It is agreed that working with non-ints is no longer the intended behavior, but 
there is undoubtedly code that uses it -- especially in cases where the return 
value could be either an int or a float.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to