builtin_id() returns negative numbers
Maybe it's just a wart we have to live with now; OTOH, the docs explicitly warn that id() may return a long, so any code relying on "short int"-ness has always been relying on an implementation quirk.
Well, the docs say that %x does unsigned conversion, so they've been relying on an implementation quirk as well ;) Would it be practical to add new conversion syntax to string interpolation? Like, for example, %p as an unsigned hex number the same size as (void *). Otherwise, unless I misunderstand integer unification, one would just have to strike the distinction between, say, %d and %u.
Richard Brodie wrote:
Otherwise, unless I misunderstand integer unification, one would just have to strike the distinction between, say, %d and %u.
Couldn't that be done anyway? The distinction really only makes sense in C, where there's no way of knowing whether the value is signed or unsigned otherwise. In Python the value itself knows whether it's signed or not. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg.ewing@canterbury.ac.nz +--------------------------------------+
Otherwise, unless I misunderstand integer unification, one would just have to strike the distinction between, say, %d and %u.
Couldn't that be done anyway? The distinction really only makes sense in C, where there's no way of knowing whether the value is signed or unsigned otherwise. In Python the value itself knows whether it's signed or not.
The time machine is at your service: in Python 2.4 there's no difference. That's integer unification for you! -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Greg Ewing -
Guido van Rossum -
Richard Brodie