Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Brett Cannon
The PEP has been rejected. -Brett On 8/25/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/25/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > I wish Fredrik would chime in. He would > > have something pithy, angry, and incisive to say about this. > > Raymond, I'm sick of the abuse

Re: [Python-Dev] PEP 342: simple example, closure alternative

2005-08-25 Thread Ian Bicking
Andrew Koenig wrote: >>A closure based accumulator (using Scheme): >> >>(define (accum n) >> (lambda (incr) >> (set! n (+ n incr)) >> n)) >>(define s (accum 0)) >>(s 1) ; -> 1 == 0+1 >>(s 5) ; -> 6 == 1+5 >> >>So I thought the generator version might look like: >> >>def accum(n): >> while

Re: [Python-Dev] PEP 342: simple example, closure alternative

2005-08-25 Thread Andrew Koenig
> A closure based accumulator (using Scheme): > > (define (accum n) > (lambda (incr) >(set! n (+ n incr)) >n)) > (define s (accum 0)) > (s 1) ; -> 1 == 0+1 > (s 5) ; -> 6 == 1+5 > > So I thought the generator version might look like: > > def accum(n): > while 1: > incr =

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Guido van Rossum
On 8/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Guido> It's never too early to start deprecating a feature we know will > Guido> disappear in 3.0. > > Though if it's a widely used feature the troops will be highly annoyed by > all the deprecation warnings. (Or does deprecatio

Re: [Python-Dev] Style for raising exceptions (python-dev Summary for 2005-08-01 through 2005-08-15 [draft])

2005-08-25 Thread Guido van Rossum
On 8/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I do have a followup question on the style thing. (I'll leave others to > answer MAL's question about optimization.) If I want to raise an exception > without an argument, which of the following is the proper form? > > raise ValueErr

Re: [Python-Dev] Style for raising exceptions (python-dev Summary for 2005-08-01 through 2005-08-15 [draft])

2005-08-25 Thread skip
MAL> I must have missed this one: That's because it was brief and to the point, so the discussion lasted for maybe three messages. Also, someone told us you were on holiday so we thought we could squeak it through without you noticing. Darn those Aussies. Late on the pydev summary again!

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread skip
Guido> It's never too early to start deprecating a feature we know will Guido> disappear in 3.0. Though if it's a widely used feature the troops will be highly annoyed by all the deprecation warnings. (Or does deprecation not coincide with emitting warnings?) Skip _

Re: [Python-Dev] PEP 342: simple example, closure alternative

2005-08-25 Thread Ian Bicking
Phillip J. Eby wrote: > At 02:10 PM 8/25/2005 -0500, Ian Bicking wrote: > >>I was trying to translate a pattern that uses closures in a language >>like Scheme (where closed values can be written to) to generators using >>PEP 342, but I'm not clear exactly how it works; the examples in the PEP >>ha

Re: [Python-Dev] PEP 342: simple example, closure alternative

2005-08-25 Thread Phillip J. Eby
At 02:10 PM 8/25/2005 -0500, Ian Bicking wrote: >I was trying to translate a pattern that uses closures in a language >like Scheme (where closed values can be written to) to generators using >PEP 342, but I'm not clear exactly how it works; the examples in the PEP >have different motivations. Sinc

[Python-Dev] PEP 342: simple example, closure alternative

2005-08-25 Thread Ian Bicking
I was trying to translate a pattern that uses closures in a language like Scheme (where closed values can be written to) to generators using PEP 342, but I'm not clear exactly how it works; the examples in the PEP have different motivations. Since I can't actually run these examples, perhaps s

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Ron Adam
Raymond Hettinger wrote: >>Deprecation means your code will still work I hope every book that >>documents "except:" also adds "but don't use this except under very >>special circumstances". >> >>I think you're overreacting (again), Raymond. 3.0 will be much more >>successful if we can introduce man

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Steve Holden
Guido van Rossum wrote: > On 8/25/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > >>I wish Fredrik would chime in. He would >>have something pithy, angry, and incisive to say about this. > > > Raymond, I'm sick of the abuse. Consider the PEP rejected. > Perhaps you should go for the £10

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Michael Chermside
[PLEASE IGNORE PREVIOUS EMAIL... I HIT [Send] BY MISTAKE] Guido: > But how about the following compromise: make it a silent deprecation > in 2.5, and a full deprecation in 2.6. Reinhold Birkenfeld: > That said, I think that unless it is a new feature (like with statements) > transitions to Pytho

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Michael Chermside
Guido: > But how about the following compromise: make it a silent deprecation > in 2.5, and a full deprecation in 2.6. Reinhold Birkenfeld: > That said, I think that unless it is a new feature (like with statements) > transitions to Python 3.0 shouldn't be enforced in the 2.x series. With 3.0, > e

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Guido van Rossum
On 8/25/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > I wish Fredrik would chime in. He would > have something pithy, angry, and incisive to say about this. Raymond, I'm sick of the abuse. Consider the PEP rejected. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Scott David Daniels
Raymond Hettinger wrote: >... I propose that the transition plan be as simple as introducing > BaseException. This allows people to write code that will work on both > 2.x and 3.0. It doesn't break anything. > > The guidance for cross-version (2.5 to 3.0) code would be: > > * To catch all but

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Raymond Hettinger
> > Also, as we learned with apply(), even if > > ignored, the deprecation machinery has a tremendous runtime cost. None > > of this will make upgrading to Py2.5 an attractive option. > > Not in this case; bare except: can be flagged by the parser so the > warning happens only once per compilatio

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Reinhold Birkenfeld
Raymond Hettinger wrote: >> Deprecation means your code will still work I hope every book that >> documents "except:" also adds "but don't use this except under very >> special circumstances". >> >> I think you're overreacting (again), Raymond. 3.0 will be much more >> successful if we can introdu

Re: [Python-Dev] Revised PEP 349: Allow str() to return unicode strings

2005-08-25 Thread Neil Schemenauer
On Wed, Aug 24, 2005 at 09:11:18PM +0200, Dieter Maurer wrote: > Neil Schemenauer <[EMAIL PROTECTED]> writes on Mon, 22 Aug 2005 15:31:42 > -0600: > > The code was fixed by changing > > the line "header = str(header)" to: > > > > if isinstance(header, unicode): > > hea

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Guido van Rossum
On 8/25/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >[...] AFAICT, there is no other way to broadly > catch exceptions not derived from Exception. But there is rarely a need to do so. I bet you that 99 out of 100 bare excepts in the stdlib could be replaced by "except Exception" without break

Re: [Python-Dev] [Argon] Re: 51 Million calls to _PyUnicodeUCS2_IsLinebreak() (???)

2005-08-25 Thread Greg Wilson
> > Walter Dörwald wrote: > >>At least it would remove the quadratic number of calls to > >>_PyUnicodeUCS2_IsLinebreak(). For each character it would be called only > >>once. > Martin v. Löwis wrote: > > Correct. However, I very much doubt that this is the cause of the > > slowdown. > Walter Dörw

Re: [Python-Dev] [Argon] Re: 51 Million calls to _PyUnicodeUCS2_IsLinebreak() (???)

2005-08-25 Thread Greg Wilson
Hi Martin (and everyone else); thanks for your mail. The N*N/2 invocations would explain why we saw such a large number of invocations --- thanks for figuring it out. W.r.t. how we're invoking our script: > > But if you're using CGI, you're importing your source on every > > invocation. > > Well

Re: [Python-Dev] Revised PEP 349: Allow str() to return unicode strings

2005-08-25 Thread Dieter Maurer
The following message is a courtesy copy of an article that has been posted to comp.lang.python as well. Neil Schemenauer <[EMAIL PROTECTED]> writes on Mon, 22 Aug 2005 15:31:42 -0600: > ... > Some code may require that str() returns a str instance. In the > standard library, only one suc

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Neil Schemenauer
On Thu, Aug 25, 2005 at 11:58:48AM -0400, Raymond Hettinger wrote: > Deprecation is only warranted if the interim substitute works -- > AFAICT, there is no other way to broadly catch exceptions not > derived from Exception. This seems to get to the heart of the problem. I'm no fan of bare excepts

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Raymond Hettinger
> Deprecation means your code will still work I hope every book that > documents "except:" also adds "but don't use this except under very > special circumstances". > > I think you're overreacting (again), Raymond. 3.0 will be much more > successful if we can introduce many of its features into 2.

Re: [Python-Dev] Style for raising exceptions (python-dev Summary for 2005-08-01 through 2005-08-15 [draft])

2005-08-25 Thread Guido van Rossum
On 8/25/05, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > I must have missed this one: > > > > > Style for raising exceptions > > > > > > Guido explained that these days exceptions should always be raised as:: > > > > raise SomeException("

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Tim Lesher
On 8/25/05, Sjoerd Mullender <[EMAIL PROTECTED]> wrote: > There is an important point, though. Recently I read complaints about > the lack of backward compatibility in Python on the fedora-list (mailing > list for users of Fedora Core). Somebody asked what language he should > learn and people an

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Guido van Rossum
On 8/25/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > It's only an overstatement if Guido didn't mean what he said. If bare > except clauses are deprecated in 2.x, it WILL affect tons of existing > code and invalidate a portion of almost all Python books. Deprecation means your code will sti

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Sjoerd Mullender
Michael Chermside wrote: > Raymond writes: > >>Efforts to improve Py3.0 have spilled >>over into breaking Py2.x code with no compensating benefits. [...] >>We don't have to wreck 2.x in order to make 3.0 better. > > > I think you're overstating things a bit here. There is an important point, th

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Raymond Hettinger
> > Efforts to improve Py3.0 have spilled > > over into breaking Py2.x code with no compensating benefits. [...] > > We don't have to wreck 2.x in order to make 3.0 better. > > I think you're overstating things a bit here. It's only an overstatement if Guido didn't mean what he said. If bare exc

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Michael Chermside
Raymond writes: > Efforts to improve Py3.0 have spilled > over into breaking Py2.x code with no compensating benefits. [...] > We don't have to wreck 2.x in order to make 3.0 better. I think you're overstating things a bit here. > Remember, the ONLY benefit from the whole PEP is that in 3.0, it w

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Raymond Hettinger
> > OK, I'm convinced. Let's drop bare except for Python 3.0, and > > deprecate them until then, without changing the meaning. > > > > Woohoo That's no cause for celebration. Efforts to improve Py3.0 have spilled over into breaking Py2.x code with no compensating benefits. Bare except clauses a

Re: [Python-Dev] Style for raising exceptions (python-dev Summary for 2005-08-01 through 2005-08-15 [draft])

2005-08-25 Thread M.-A. Lemburg
I must have missed this one: > > Style for raising exceptions > > > Guido explained that these days exceptions should always be raised as:: > > raise SomeException("some argument") > > instead of:: > > raise SomeException, "some

[Python-Dev] python-dev Summary for 2005-08-01 through 2005-08-15 [draft]

2005-08-25 Thread Tony Meyer
Here's August Part One. As usual, if anyone can spare the time to proofread this, that would be great! Please send any corrections or suggestions to Steve (steven.bethard at gmail.com) and/or me, rather than cluttering the list. Ta! = Announcements = ---

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-25 Thread Michael Hudson
Guido van Rossum <[EMAIL PROTECTED]> writes: > On 8/24/05, Michael Hudson <[EMAIL PROTECTED]> wrote: >> I really hope string exceptions can be killed off before 3.0. They >> should be fully deprecated in 2.5. > > But what about class exceptions that don't inherit from Exception? > That will take