Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Greg Ewing
Brett C. wrote: Nick's was obviously directly against looping, but, with no offense to Nick, how many other people were against it looping? It never felt like it was a screaming mass with pitchforks but more of a I don't love it, but I can deal crowd. My problem with looping was that, with

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Greg Ewing
Ron Adam wrote: He should also be able to put try excepts before the yield, and after the yield, or in the block. (But not surrounding the yield, I think.) I was given to understand that yield is currently allowed in try-except, just not try-finally. So this would require a

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Nick Coghlan
Steven Bethard wrote: If I've misunderstood, and there are other situations when needs_finish is required, it'd be nice to see some more examples. The problem is try/except/else blocks - those are currently legal, so the programmer has to make the call about whether finalisation is needed or

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Paul Moore
On 5/15/05, Steven Bethard [EMAIL PROTECTED] wrote: Having done the python-dev summary on this topic, You have my deepest sympathy :-) So in some sense, PEP 340 was the reason for the lack of enthusiasm; with the semantics laid out, people were forced to deal with a specific implementation

Re: [Python-Dev] PEP 340 keyword: after

2005-05-16 Thread Christos Georgiou
Chris Ryland [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I hate to add to what could be an endless discussion, but... ;-) In this case, while is the better time-related prefix, whether keyword (hopeless, due to ages-old boolean-controlled loop association) or function, since

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Guido van Rossum
[Guido] In rev 1.10 I moved the __enter__ call out of the try-block again. Having it inside was insane: when __enter__ fails, it should do its own cleanup rather than expecting __exit__ to clean up after a partial __enter__. [Ka-Ping Yee] No, it wasn't insane. You had a good reason for

[Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux)

2005-05-16 Thread Phillip J. Eby
At 06:56 PM 5/16/2005 +1000, Nick Coghlan wrote: Anyway, I think it's stable enough now that I can submit it to be put up on www.python.org (I'll notify the PEP editors directly once I fix a couple of errors in the current version - like the missing 'raise' in the statement semantics. . .). If

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Phillip J. Eby
At 04:57 PM 5/16/2005 +1200, Greg Ewing wrote: Guido van Rossum wrote: Also, one question: will the do protocol be added to built-in resource types? That is, locks, files, sockets, and so on? One person proposed that and it was shot down by Greg Ewing. I think it's better to require a

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Phillip J. Eby
At 09:53 PM 5/16/2005 +1000, Nick Coghlan wrote: My PEP punts on providing a general API for passing exceptions into generators by making it an internal operation. Actually, the proposals you made almost subsume PEPs 288 and 325. All you'd need to do is: 1. move the '__del__' code to a

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Shane Hathaway
Greg Ewing wrote: Brett C. wrote: Nick's was obviously directly against looping, but, with no offense to Nick, how many other people were against it looping? It never felt like it was a screaming mass with pitchforks but more of a I don't love it, but I can deal crowd. My problem with

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Guido van Rossum
[Guido (responding to Fredrik Lundh's intuitive -1 on PEP 343)] Would it be better if we pulled back in the generator exit handling from PEP 340? That's a pretty self-contained thing, and would let you write try/finally around the yield. [Nick Coghlan] That would be good, in my opinion. I

[Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Ka-Ping Yee
This PEP is a concrete proposal for exception chaining, to follow up on its mention here on Python-Dev last week as well as earlier discussions in the past year or two. http://www.python.org/peps/pep-0344.html I've tried to summarize the applications for chaining mentioned in these

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Aahz
On Mon, May 16, 2005, Ka-Ping Yee wrote: This PEP is a concrete proposal for exception chaining, to follow up on its mention here on Python-Dev last week as well as earlier discussions in the past year or two. http://www.python.org/peps/pep-0344.html I've tried to summarize the

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Russell E. Owen
In article [EMAIL PROTECTED], Phillip J. Eby [EMAIL PROTECTED] wrote: ... I personally think that StopIteration, TerminateIteration, KeyboardInterrupt and perhaps certain other exceptions should derive from some base class other than Exception (e.g. Raisable or some such) to help with the

Re: [Python-Dev] RFC: rewrite fileinput module to use itertools.

2005-05-16 Thread Martin v. Löwis
David M. Wilson wrote: Before charging on ahead with this small task, I was wondering if anyone would have any objections to such an upgrade. It seems to me that itertools.chain() could come in handy there, at least. My only objection to the current implementation is that it doesn't

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Guido van Rossum
[Ka-Ping Yee] This PEP is a concrete proposal for exception chaining, to follow up on its mention here on Python-Dev last week as well as earlier discussions in the past year or two. http://www.python.org/peps/pep-0344.html Here's a bunch of commentary: You're not giving enough credit

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Brett C.
Guido van Rossum wrote: [SNIP - bunch of points from Guido] Do we really need both __context__ and __cause__? Methinks that you only ever need one: either you explicitly chain a new exception to a cause, and then the context is probably the same or irrelevant, or you don't explicitly chain,

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Guido van Rossum
[Ron Adam] So I was wondering if something like the following is feasible? [...] with opening(file1,m),opening(file2,m),opening(file3,m) as f1,f2,f3: # do stuff with files The 'with' (or whatever) statement would need a little more under the hood, but it might simplify handling

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Jack Diederich
On Mon, May 16, 2005 at 06:24:59PM +1200, Greg Ewing wrote: Brett C. wrote: Nick's was obviously directly against looping, but, with no offense to Nick, how many other people were against it looping? It never felt like it was a screaming mass with pitchforks but more of a I don't love

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Phillip J. Eby
At 08:21 PM 5/16/2005 -0400, Jack Diederich wrote: I still haven't gotten used to Guido's heart-attack inducing early enthusiasm for strange things followed later by a simple proclamation I like. Some day I'll learn that the sound of fingernails on the chalkboard is frequently followed by candy

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Jack Diederich
On Mon, May 16, 2005 at 08:09:54PM -0500, Ka-Ping Yee wrote: On Mon, 16 May 2005, Aahz wrote: I'll comment here in hopes of staving off responses from multiple people: I don't think these should be double-underscore attributes. The currently undocumented ``args`` attribute isn't

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-16 Thread Guido van Rossum
[Jack Diederich] I prefer trichomomies over dichotomies, but whether single or double underscores are the bad or the ugly I'll leave to others. In python double underscores can only mean I don't handle this, my class does or I'm a C++ weenie, can I pretend this is private? Excluding the