Suresh Jeevanandam a écrit :
> # I am new to python.
> 
> In python all numbers are immutable. This means there is one object ( a 
> region in the memory ) created every time we do an numeric operation. I 
> hope there should have been some good reasons why it was designed this way.

The memory allocation for integers is optimized. 'Small' integers 
(between -5 and 100 IIRC) are allocated once and reused. The memory for 
larger integers is allocated once and reused whenever possible, so the 
malloc() overhead is negligible.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to