[Python-Dev] Caching float(0.0)

Bob Ippolito bob at redivi.com
Sat Sep 30 03:15:15 CEST 2006


On 9/29/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Nick Craig-Wood wrote:
>
> > Is there any reason why float() shouldn't cache the value of 0.0 since
> > it is by far and away the most common value?
>
> 1.0 might be another candidate for cacheing.
>
> Although the fact that nobody has complained about this
> before suggests that it might not be a frequent enough
> problem to be worth the effort.

My guess is that people do have this problem, they just don't know
where that memory has gone. I know I don't count objects unless I have
a process that's leaking memory or it grows so big that I notice (by
swapping or chance).

That said, I've never noticed this particular issue.. but I deal with
mostly strings. I have had issues with the allocator a few times that
I had to work around, but not this sort of issue.

-bob


More information about the Python-Dev mailing list