Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Nick Craig-Wood
On Sun, Oct 01, 2006 at 02:01:51PM -0400, Jean-Paul Calderone wrote: Each line in an interactive session is compiled separately, like modules are compiled separately. With the current implementation, literals in a single compilation unit have a chance to be cached like this. Literals in

Re: [Python-Dev] PEP 355 status

2006-10-02 Thread Jason Orendorff
On 9/30/06, Giovanni Bajo [EMAIL PROTECTED] wrote: Guido van Rossum wrote: OK. Pronouncement: PEP 355 is dead. [...] It would be terrific if you gave us some clue about what is wrong in PEP355, [...] Here are my guesses. I believe Guido rejected this PEP for a lot of reasons. By the way,

Re: [Python-Dev] PEP 315 - do while

2006-10-02 Thread Nick Coghlan
Hans Polak wrote: Hi Nick, Yep, PEP 315. Sorry about that. Now, about your suggestion do: setup code while condition loop body else: loop completion code This is pythonic, but not logical. The 'do' will execute at least once, so the

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Martin v. Löwis
Nick Coghlan schrieb: Right. Although I do wonder what kind of software people write to run into this problem. As Guido points out, the numbers must be the result from some computation, or created by an extension module by different means. If people have many *simultaneous* copies of 0.0, I

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Martin v. Löwis
Kristján V. Jónsson schrieb: Well, a lot of extension code, like ours use PyFloat_FromDouble(foo); This can be from vectors and stuff. Hmm. If you get a lot of 0.0 values from vectors and stuff, I would expect that memory usage is already high. In any case, a module that creates a lot of

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Martin v. Löwis
Kristján V. Jónsson schrieb: I can't see how this situation is any different from the re-use of low ints. There is no fundamental law that says that ints below 100 are more common than other, yet experience shows that this is so, and so they are reused. There are two important differences:

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Kristján V . Jónsson
I see, you are thinking of the general fractional case. My point was that whole numbers seem to pop up often and to reuse those is easy I did a test of tracking actual floating point numbers and the majority of heavy usage comes from integral values. It would indeed be strange if some

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Michael Hudson
Martin v. Löwis [EMAIL PROTECTED] writes: Kristján V. Jónsson schrieb: I can't see how this situation is any different from the re-use of low ints. There is no fundamental law that says that ints below 100 are more common than other, yet experience shows that this is so, and so they are

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Martin v. Löwis
Michael Hudson schrieb: 1. it is possible to determine whether the value is special in constant time, and also fetch the singleton value in constant time for ints; the same isn't possible for floats. I don't think you mean constant time here do you? Right; I really wondered whether

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Aahz
On Mon, Oct 02, 2006, Martin v. L?wis wrote: Michael Hudson schrieb: I think most of the code posted so far has been constant time, at least in terms of instruction count, though some might indeed be fairly slow on some processors -- conversion from double to integer on the PowerPC involves

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Tim Hochberg
[EMAIL PROTECTED] wrote:\/ Steve By these statistics I think the answer to the original question Steve is clearly no in the general case. As someone else (Guido?) pointed out, the literal case isn't all that interesting. I modified floatobject.c to track a few interesting floating

[Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Brett Cannon
In the interest of time I have decided to go ahead and do the PEP 302 phase 2 work in C. I fully expect to tackle rewriting import in Python in my spare time after I finish this work since I will be much more familiar with how the whole import machinery works and it sounds like a fun challenge.

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Phillip J. Eby
At 01:01 PM 10/2/2006 -0700, Brett Cannon wrote: In the interest of time I have decided to go ahead and do the PEP 302 phase 2 work in C. Just FYI, it's not possible (so far as I know) to implement phase 2 while maintaining backward compatibility with existing 2.x code. So this work shouldn't

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Paul Moore
On 10/2/06, Phillip J. Eby [EMAIL PROTECTED] wrote: Just FYI, it's not possible (so far as I know) to implement phase 2 while maintaining backward compatibility with existing 2.x code. So this work shouldn't go back to the 2.x trunk without discussion of those issues. While that's a fair

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Brett Cannon
On 10/2/06, Paul Moore [EMAIL PROTECTED] wrote: On 10/2/06, Phillip J. Eby [EMAIL PROTECTED] wrote:[SNIP] I'm surprised, however, that you think working on this in C is going to be *less* time than it would take to simply replace __import__ with a Python function that reimplements PEP 302...That

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Delaney, Timothy (Tim)
[EMAIL PROTECTED] wrote: Steve By these statistics I think the answer to the original question Steve is clearly no in the general case. As someone else (Guido?) pointed out, the literal case isn't all that interesting. I modified floatobject.c to track a few interesting floating

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Phillip J. Eby
At 03:48 PM 10/2/2006 -0700, Brett Cannon wrote: On 10/2/06, Paul Moore mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: On 10/2/06, Phillip J. Eby mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: [SNIP] I'm surprised, however, that you think working on this in C is going to be *less* time

[Python-Dev] PSF Infrastructure Committee's recommendation for a new issue tracker

2006-10-02 Thread Brett Cannon
On behalf of the PSF Infrastructure committee, I am happy to report that we have reached a recommendation for a new issue tracker for Python!But first, I want to extend our thanks to all who stepped forward to provide the committee with a test installation of an issue tracker to use as a basis of

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread Terry Reedy
Kristján V. Jónsson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Anyway, Skip noted that 50% of all floats are whole numbers between -10 and 10 inclusive, Please, no. He said something like this about *non-floating-point applications* (evidence unspecified, that I remember).

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread A.M. Kuchling
On Mon, Oct 02, 2006 at 11:27:07PM +0100, Paul Moore wrote: Yes, I'm quite surprised at how much has appeared in pkgutil. The what's new entry is very terse, and the module documentation itself hasn't been updated to mention the new stuff. These two things are related, of course; I couldn't

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread skip
Tim This doesn't actually give us a very useful indication of potential Tim memory savings. What I think would be more useful is tracking the Tim maximum simultaneous count of each value i.e. what the maximum Tim refcount would have been if they were shared. Most definitely. I

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread skip
Terry Kristján V. Jónsson [EMAIL PROTECTED] wrote: Anyway, Skip noted that 50% of all floats are whole numbers between -10 and 10 inclusive, Terry Please, no. He said something like this about Terry *non-floating-point applications* (evidence unspecified, that I Terry

Re: [Python-Dev] Created branch for PEP 302 phase 2 work (in C)

2006-10-02 Thread Phillip J. Eby
At 08:21 PM 10/2/2006 -0400, A.M. Kuchling wrote: On Mon, Oct 02, 2006 at 11:27:07PM +0100, Paul Moore wrote: Yes, I'm quite surprised at how much has appeared in pkgutil. The what's new entry is very terse, and the module documentation itself hasn't been updated to mention the new stuff.

Re: [Python-Dev] Caching float(0.0)

2006-10-02 Thread skip
skip Most definitely. I just posted what I came up with in about two skip minutes. I'll add some code to track the high water mark as well skip and report back. Using the smallest change I could get away with, I came up with these allocation figures (same as before): -1.0: