Why does int(5.0) returns 0

Samir Patel spatel at cinci.rr.com
Mon Jan 27 00:50:17 CET 2003


Here is verbose output of program: print int(5.0)

It outputs 0

********************************************************


# /usr/lib/python2.2/site.pyc matches /usr/lib/python2.2/site.py
import site # precompiled from /usr/lib/python2.2/site.pyc
# /usr/lib/python2.2/os.pyc matches /usr/lib/python2.2/os.py
import os # precompiled from /usr/lib/python2.2/os.pyc
import posix # builtin
# /usr/lib/python2.2/posixpath.pyc matches /usr/lib/python2.2/posixpath.py
import posixpath # precompiled from /usr/lib/python2.2/posixpath.pyc
# /usr/lib/python2.2/stat.pyc matches /usr/lib/python2.2/stat.py
import stat # precompiled from /usr/lib/python2.2/stat.pyc
# /usr/lib/python2.2/UserDict.pyc matches /usr/lib/python2.2/UserDict.py
import UserDict # precompiled from /usr/lib/python2.2/UserDict.pyc
# /usr/lib/python2.2/copy_reg.pyc matches /usr/lib/python2.2/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.2/copy_reg.pyc
# /usr/lib/python2.2/types.pyc matches /usr/lib/python2.2/types.py
import types # precompiled from /usr/lib/python2.2/types.pyc
# /usr/lib/python2.2/__future__.pyc matches /usr/lib/python2.2/__future__.py
import __future__ # precompiled from /usr/lib/python2.2/__future__.pyc
# /usr/lib/python2.2/site-packages/sitecustomize.pyc matches 
/usr/lib/python2.2/site-packages/sitecustomize.py
import sitecustomize # precompiled from 
/usr/lib/python2.2/site-packages/sitecustomize.pyc
Python 2.2.2 (#1, Jan 24 2003, 17:43:45)
[GCC 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
0
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] __future__
# cleanup[1] signal
# cleanup[1] site
# cleanup[1] sitecustomize
# cleanup[1] posix
# cleanup[1] types
# cleanup[1] exceptions
# cleanup[2] stat
# cleanup[2] copy_reg
# cleanup[2] posixpath
# cleanup[2] UserDict
# cleanup[2] os
# cleanup[2] os.path
# cleanup sys
# cleanup __builtin__
# cleanup ints: 3 unfreed ints in 1 out of 3 blocks
# cleanup floats






More information about the Python-list mailing list