Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Alex Martelli
On Jan 20, 2006, at 1:39 PM, Phillip J. Eby wrote: > At 11:19 AM 01/20/2006 -0800, Guido van Rossum wrote: >> (There *are*other uses besides the trampoline, >> right? :-) > > It's easy to come up with use cases where you feed data *into* a > generator > (parsers and pipelines, for example). I

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Andrew Koenig
> The discussion about PEP 343 reminds me of the following. Bram Cohen > pointed out in private email that, before PEP 342, there wasn't a big > need for a shortcut to pass control to a "sub-generator" because the > following for-loop works well enough: > def main_generator(): > ... >

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Nick Coghlan
Nick Coghlan wrote: > Exception propagation is a different story. What do you want to propagate? > All > exceptions from the body of the for loop? Or just those from the yield > statement? > > Well, isn't factoring out exception processing part of what PEP 343 is for? ># We can even limit

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Nick Coghlan
Phillip J. Eby wrote: >> Thoughts? > > If we have to have a syntax, "yield from sub_generator()" seems clearer > than "yieldthrough", and doesn't require a new keyword. Andrew Koenig suggested the same phrasing last year [1], and I liked it then. I don't like it any more, though, as I think it

Re: [Python-Dev] PEP 343 and __context__()

2006-01-20 Thread Nick Coghlan
Jason Orendorff wrote: > On 1/20/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> Jason Orendorff wrote: >>> DecimalContext has a few problems. In code where it matters, every >>> function you write has to worry about it. (That is, you can't just >>> write __decimal_context__ = ... at the top of the

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Phillip J. Eby
At 11:19 AM 01/20/2006 -0800, Guido van Rossum wrote: >(There *are*other uses besides the trampoline, >right? :-) It's easy to come up with use cases where you feed data *into* a generator (parsers and pipelines, for example). I just don't know of any "simultaneous bidirectional" uses other tha

Re: [Python-Dev] [Python-checkins] r42116 - python/branches/release24-maint/Lib/unittest.py

2006-01-20 Thread Georg Brandl
Barry Warsaw wrote: > On Fri, 2006-01-20 at 21:43 +0100, Thomas Wouters wrote: > >> I don't believe this belongs in 2.4, since it can, actually, break code. >> Code that depends on the current situation, _TestCase__attributename. >> Fragile code, to be sure, but still. If there were a compelling r

Re: [Python-Dev] [Python-checkins] r42116 - python/branches/release24-maint/Lib/unittest.py

2006-01-20 Thread Barry Warsaw
On Fri, 2006-01-20 at 21:43 +0100, Thomas Wouters wrote: > I don't believe this belongs in 2.4, since it can, actually, break code. > Code that depends on the current situation, _TestCase__attributename. > Fragile code, to be sure, but still. If there were a compelling reason to > backport, I gues

Re: [Python-Dev] [Python-checkins] r42116 - python/branches/release24-maint/Lib/unittest.py

2006-01-20 Thread Guido van Rossum
Right. This *definitely* is a feature, not a bug. On 1/20/06, Thomas Wouters <[EMAIL PROTECTED]> wrote: > On Fri, Jan 20, 2006 at 06:55:03PM +0100, georg.brandl wrote: > > Author: georg.brandl > > Date: Fri Jan 20 18:55:02 2006 > > New Revision: 42116 > > > > Modified: > >python/branches/relea

Re: [Python-Dev] [Python-checkins] r42116 - python/branches/release24-maint/Lib/unittest.py

2006-01-20 Thread Thomas Wouters
On Fri, Jan 20, 2006 at 06:55:03PM +0100, georg.brandl wrote: > Author: georg.brandl > Date: Fri Jan 20 18:55:02 2006 > New Revision: 42116 > > Modified: >python/branches/release24-maint/Lib/unittest.py > Log: > Patch #1388073: Make unittest.TestCase easier to subclass I don't believe this be

Re: [Python-Dev] PEP 343 and __context__()

2006-01-20 Thread Jason Orendorff
On 1/20/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Jason Orendorff wrote: > > DecimalContext has a few problems. In code where it matters, every > > function you write has to worry about it. (That is, you can't just > > write __decimal_context__ = ... at the top of the file and be done > > with

Re: [Python-Dev] site triggering a bug in urllib2

2006-01-20 Thread John J Lee
On Tue, 17 Jan 2006, Thomas Mangin wrote: [...] > I have hit a bug with python 2.4.2 (on Mandriva 2006) using urllib2. > The code which trigger the bug is as follow.. > > import urllib2 > req = urllib2.Request("http://66.117.37.13/";) > > # makes no difference .. > req.add_header('Connection', 'clo

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Edward C. Jones
Guido van Rossum <[EMAIL PROTECTED]> wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a "sub-generator" because the following for-loop works well enough: def ma

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Guido van Rossum
On 1/20/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 10:17 AM 01/20/2006 -0800, Guido van Rossum wrote: > >The discussion about PEP 343 reminds me of the following. Bram Cohen > >pointed out in private email that, before PEP 342, there wasn't a big > >need for a shortcut to pass control to a

Re: [Python-Dev] site triggering a bug in urllib2

2006-01-20 Thread Bill Janssen
Or the Web-SIG mailing list. Bill ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Phillip J. Eby
At 10:17 AM 01/20/2006 -0800, Guido van Rossum wrote: >The discussion about PEP 343 reminds me of the following. Bram Cohen >pointed out in private email that, before PEP 342, there wasn't a big >need for a shortcut to pass control to a "sub-generator" because the >following for-loop works well eno

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Christian Tanzer
Guido van Rossum <[EMAIL PROTECTED]> wrote: > The discussion about PEP 343 reminds me of the following. Bram Cohen > pointed out in private email that, before PEP 342, there wasn't a big > need for a shortcut to pass control to a "sub-generator" because the > following for-loop works well enough:

Re: [Python-Dev] site triggering a bug in urllib2

2006-01-20 Thread Aahz
On Tue, Jan 17, 2006, Thomas Mangin wrote: > > I am contacting the list in the hope that someone will be able to > understand what I am seeing. You'll probably get more help by subscribing and posting to comp.lang.python. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.c

[Python-Dev] yield back-and-forth?

2006-01-20 Thread Guido van Rossum
The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a "sub-generator" because the following for-loop works well enough: def main_generator(): ... for value in

Re: [Python-Dev] PEP 343 and __context__()

2006-01-20 Thread Phillip J. Eby
At 07:21 PM 01/20/2006 +1000, Nick Coghlan wrote: >Yeah, it came up in response to PJE's suggestion of task-local variables for >generators. The basic concept we came up with is that if you're writing a >generator that uses a specific context, remember to save the original and >restore it around an

Re: [Python-Dev] pystate.c changes for Python 2.4.2

2006-01-20 Thread Tim Peters
[Tim] >> ... >> As a result, it so happens that core Python never uses the original >> PyThreadState_Delete() anymore, except when Py_NewInterpreter() has >> to throw away the brand new thread state it created because it turns out >> it can't create a new interpreter. [Michael] > Um, PyThreadState

Re: [Python-Dev] timeit module

2006-01-20 Thread Nick Coghlan
Steve Holden wrote: > Connelly Barnes wrote: >> Hi, >> >> Perhaps I am the only one bothered by the timeit >> module, but it seems poorly designed to me. >> >> First of all, it should use a geometric series with a >> timeout value to detect how many iterations it should >> perform. Currently, the

Re: [Python-Dev] ConfigParser to save with order

2006-01-20 Thread Paramjit Oberoi
> I think it's moot unless you also preserve comments. Ideally would be > something that prserved everything (ordering, blank lines, comments > etc.) from how it was read in. Modifying a value should keep its > position. Adding a value should add it to the end of the section it's > in (unless there

Re: [Python-Dev] str with base

2006-01-20 Thread Stephen J. Turnbull
> "BAW" == Barry Warsaw <[EMAIL PROTECTED]> writes: BAW> Unix weenies shouldn't be totally forgotten in P3K. Great idea! Put all this stuff in a "weenie" module. You can have weenie.unix and weenie.vms and weenie.unicode, besides the weenie.math that got all this started. -- School of

Re: [Python-Dev] ConfigParser to save with order

2006-01-20 Thread Tony Meyer
[Tony Meyer] > Allowing 'surgical' editing of configuration files, as has been > proposed many times both here and c.l.p would not require > ConfigParser to be entirely rewritten (just more extensive > modification of the write() method). After writing the summary of this thread, I figured I might

Re: [Python-Dev] timeit module

2006-01-20 Thread Connelly Barnes
Connelly Barnes wrote: >> Hi, >> >> Perhaps I am the only one bothered by the timeit >> module, but it seems poorly designed to me. >> >> First of all, it should use a geometric series with a >> timeout value to detect how many iterations it should >> perform. Currently, the user is required to

[Python-Dev] site triggering a bug in urllib2

2006-01-20 Thread Thomas Mangin
Hello, I am contacting the list in the hope that someone will be able to understand what I am seeing. I have hit a bug with python 2.4.2 (on Mandriva 2006) using urllib2. The code which trigger the bug is as follow.. import urllib2 req = urllib2.Request("http://66.117.37.13/";) # makes no di

Re: [Python-Dev] pystate.c changes for Python 2.4.2

2006-01-20 Thread Michael Hudson
Tim Peters <[EMAIL PROTECTED]> writes: > [Gabriel Becedillas] >> Can anybody tell me if the patch I suggested is ok ? >> That will be to add the following code at the end of PyThreadState_Delete: >> >> if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate) >> PyThread_delete_key_valu

Re: [Python-Dev] PEP 343 and __context__()

2006-01-20 Thread Nick Coghlan
Jason Orendorff wrote: > I just noticed that my name is in PEP 343 attached to the idea of the > __context__() method, and I'm slightly queasy over it. > > The rationale was to help e.g. decimal.DecimalContext support 'with'. > Maybe that's a bad idea. > > DecimalContext has a few problems. In