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

2005-06-15 Thread Benji York
Steven Bethard wrote: > It reminds me of one of my minor gripes about the standard lib -- a > number of functions that take another function as an argument don't > take *args and **kwargs to be passed to that function when it's > called. The iter() alternate form is a common example of this. I > wo

[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 oppo

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: > > while > > with executed once prior to first being tested. But the > above is ugly, and you can get much the same effect

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

Re: [Python-Dev] Wishlist: dowhile

2005-06-15 Thread Nicolas Fleury
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 "works just fine"). I find PEP 315 counter-in

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Martin v. Löwis
Michael Hudson wrote: > if (ProfilerError == NULL) > ProfilerError = PyErr_NewException("hotshot.ProfilerError", >NULL, NULL); > if (ProfilerError != NULL) { > Py_INCREF(ProfilerError); > PyModule_A

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

2005-06-15 Thread Skip Montanaro
Armin> But it's all quite obscure. If this was comp.lang.python I'd nominate this for QOTW... Skip ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/opt

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

2005-06-15 Thread Armin Rigo
Hi Michael, On Wed, Jun 15, 2005 at 03:26:00PM +0100, Michael Hudson wrote: > > Hum, you probably don't want to know, but it works just fine to forget > > a Py_INCREF before PyModule_AddObject() for the following reason: > > No, it's more complicated than that, at least in an embedded > scenario

Re: [Python-Dev] PEP 343 question

2005-06-15 Thread Guido van Rossum
On 6/15/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > 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. Tha

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 again

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 Dial

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); >

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 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] 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 Michael Hudson
Skip Montanaro <[EMAIL PROTECTED]> writes: > 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 t

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] 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 [from ] [step ] to ] > > [while ] > > do od > As far as I remember, it was: > do > > while > > od > It might be that this could be preceded by a 'for'

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 >> speedu

[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), but

Re: [Python-Dev] Wishlist: dowhile

2005-06-15 Thread Nick Coghlan
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. I hadn't actually thought about the temptation to try and have multiple 'until' s

[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.