PEP238 and zope

Tim Peters tim.one at home.com
Wed Jul 25 02:27:10 EDT 2001


[Christian Tanzer]
> This isn't portable behavior. According to the python library
> reference, `int` may round on some platforms.

Ya, we have to say that because the C standard (C89) said that, and Python
doesn't try to worm around the platform C's behavior in this area.

However, while we've found platforms where the platform C doesn't
sign-extend right shifts of signed integers (OK by the C std), and platforms
with no integral type T such that sizeof(T) == 2 (also OK), and platforms
with no standard integral type T such that sizeof(T) >= sizeof(void*) (also
OK!), I don't believe we've found any platform where casting to an integral
type doesn't truncate.  So this one is an academic warning of no practical
consequence.  Note too that the new C std ("C99") requires truncation.





More information about the Python-list mailing list