I have been programming in Python only for a month or so and have stumbled
over a "problem" that I could not solve through rtfm.
$ python
Python 2.2.2 (#1, Nov 6 2003, 09:19:47)
[GCC 3.3] on irix646
Type "help", "copyright", "credits" or "license" for more information.
ulong_max=18446744073709551615
type(ulong_max) <type 'long'> print ulong_max 18446744073709551615 very_long_long=18446744073709551615184467440737095 51615
type(very_long_long) <type 'long'> print very_long_long 1844674407370955161518446744073709551615 result=very_long_long/15
type(result) <type 'long'> print result 122978293824730344101229782938247303441
I have set ulong_max above to the C compilers ULONG_MAX definition from limits.h
I would have expected Python to complain when setting the value of the variable
very_long_long to anything greater than ULONG_MAX.
Since I am currently doing computations with integer values *much* bigger than
ULONG_MAX, this behaviour suites me, but I am wondering if this is a "standard"
Python behaviour since I do not want my scripts to become dependant on some
obscure non-standard feature...
Could any kind Python-Guru please shed some light on this?
Also, if Python really can handle longs that are bigger than the machines native
longs, the interpreter has to do some sort of arbitrary precision math
somewhere. Could you please point me to the according interpreter's source file(s)?
TIA + Regards,
S.Susnjar