Python syntax in Lisp and Scheme
Andrew Dalke
adalke at mindspring.com
Tue Oct 7 01:41:52 EDT 2003
Gerrit Holl:
> a = 2
> a = 1 + 1
> a = math.sqrt(4)
> a = int((sys.maxint+1) ** (1/31))
>
> ...all mean the same thing.
Be careful with that. The first two return the integer 4, the third returns
the floating point number 4.0 and the last returns 1 because 1/31 is
0 (unless you are using true division). Even if you use 1/31. you'll
get a different value on a 32 bit machine vs. a 64 bit machine.
pedantically yours,
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list