[Python-Dev] PEP 343 question

2005-06-15 Thread Raymond Hettinger
In gen.throw(), are all three arguments required? Or do the value and traceback Nones need to be listed explicitly? g.throw(MyException) or g.throw(MyException, None, None) FWIW, I prefer the former. That will make throw() as flexible as the raise statement. Raymond

[Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Michael Hudson
I've just fixed a bug where Py_INCREF wasn't called when it should have been before a call to PyModule_AddObject (rev. 2.62 of Modules/threadmodule.c). So I went looking for other instances of the same problem. I didn't find any (though I don't understand how _csv.c gets away with line 1579),

Re: [Python-Dev] Compiling Python with Intel compiler?

2005-06-15 Thread Michael Hoffman
On Tue, 14 Jun 2005, Martin v. Löwis wrote: Guido van Rossum wrote: Intel has a free (as in beer) C compiler for Linux. A friend of mine is involved in its production and marketing. He would like to see how his compiler does on Python -- does it work at all, and is there a speedup? There

Re: [Python-Dev] Wishlist: dowhile

2005-06-15 Thread Andrew Koenig
I believe that Algol 68 loops looked like the following (in somewhat more Python-like terms): [for identifier [from suite] [step suite] to suite] [while suite] do suite od As far as I remember, it was: do suite while suite; ending with a boolean value

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Skip Montanaro
Michael So I went looking for other instances of the same problem. I Michael didn't find any (though I don't understand how _csv.c gets away Michael with line 1579)... Same reason the Py_INCREF of ProfileError isn't necessary I think. PyDict_New() returns a new reference which is

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Skip Montanaro
Michael ... (though I don't understand how _csv.c gets away Michael with line 1579)... Michael Oops; I meant line 1590. Hmmm... Me either. Is it possible it was just never DECREF'd? I checked in the obvious fix on both head and the 2.4 release branch. Skip

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Armin Rigo
Hi Michael, On Wed, Jun 15, 2005 at 01:35:35PM +0100, Michael Hudson wrote: if (ProfilerError == NULL) ProfilerError = PyErr_NewException(hotshot.ProfilerError, NULL, NULL); if (ProfilerError != NULL) {

Re: [Python-Dev] [Python-checkins] python/dist/src/Modules _csv.c, 1.37, 1.38

2005-06-15 Thread Armin Rigo
Hi Skip, On Wed, Jun 15, 2005 at 06:35:10AM -0700, [EMAIL PROTECTED] wrote: Why this worked is a bit mystical. Perhaps it never gets freed because the object just happens never to be DECREF'd (but that seems unlikely). /* Add the Dialect type */ + Py_INCREF(Dialect_Type);

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Michael Hudson
Armin Rigo [EMAIL PROTECTED] writes: Hi Michael, On Wed, Jun 15, 2005 at 01:35:35PM +0100, Michael Hudson wrote: if (ProfilerError == NULL) ProfilerError = PyErr_NewException(hotshot.ProfilerError, NULL, NULL); if

Re: [Python-Dev] [Python-checkins] python/dist/src/Modules _csv.c, 1.37, 1.38

2005-06-15 Thread Michael Hudson
Armin Rigo [EMAIL PROTECTED] writes: Hi Skip, On Wed, Jun 15, 2005 at 06:35:10AM -0700, [EMAIL PROTECTED] wrote: Why this worked is a bit mystical. Perhaps it never gets freed because the object just happens never to be DECREF'd (but that seems unlikely). /* Add the Dialect type

Re: [Python-Dev] python running in several threads

2005-06-15 Thread Martin Aliger
Thanks both for answers, I read some articles you link and I'd to say - alot discussion around! I also found some notes that mod_python use some technique other than GIL to allow multi-threading in Apache 2.0. Does someone know anything closer? Any links or so? Sorry I raise this old stuff

Re: [Python-Dev] Wishlist: dowhile

2005-06-15 Thread Charles Cazabon
Nicolas Fleury [EMAIL PROTECTED] wrote: Guido van Rossum wrote: Why are you so excited about having until indented? You didn't give any examples with multiple occurrences. A single occurrence works just fine unindented, as PEP 315 has already shown. FWIW, I must say I disagree (about

Re: [Python-Dev] Wishlist: dowhile

2005-06-15 Thread Josiah Carlson
Charles Cazabon [EMAIL PROTECTED] wrote: Indeed. The original poster seems to want something that would work (not necessarily look) like this: do: block while condition with block executed once prior to condition first being tested. But the above is ugly, and you can get

[Python-Dev] iter alternate form and *args and **kwargs (Was: Wishlist: dowhile)

2005-06-15 Thread Steven Bethard
Jp Calderone: for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''): f2.write(chunk) Phillip J. Eby: More seriously, I think your translation makes an excellent argument in *favor* of having a do/while statement for greater clarity. :) Michael Chermside Interesting... I had the opposite