Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-02-15 Thread Michael Hudson
Michael Hudson [EMAIL PROTECTED] writes: Michael Hudson [EMAIL PROTECTED] writes: I hope to have a new patch (which makes PyExc_Exception new-style, but allows arbitrary old-style classes as exceptions) soon. It may even pass bits of make test :) Done: http://www.python.org/sf/1104669

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-02-15 Thread Guido van Rossum
My design decision was to make Exception new-style. Things can be raised if they are instances of old-style classes or instances of Exception. If this meets with general agreement, I'd like to check the above patch in. I like it, but didn't you forget to mention that strings can still be

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-02-15 Thread Michael Hudson
Guido van Rossum [EMAIL PROTECTED] writes: My design decision was to make Exception new-style. Things can be raised if they are instances of old-style classes or instances of Exception. If this meets with general agreement, I'd like to check the above patch in. I like it, but didn't you

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-18 Thread Michael Hudson
Martin v. Löwis [EMAIL PROTECTED] writes: Guido van Rossum wrote: a) Is Exception to be new-style? Probably not in 2.5; Martin and others have suggested that this could introduce instability for users' existing exception classes. Really? I thought that was eventually decided to be a very small

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Armin Rigo
Hi, On Fri, Jan 14, 2005 at 07:20:31PM -0500, Jim Jewett wrote: The base of the Exception hierarchy happens to be a classic class. But why are they required to be classic? For reference, PyPy doesn't have old-style classes at all so far, so we had to come up with something about exceptions.

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Armin Rigo
Hi Guido, On Mon, Jan 17, 2005 at 07:27:33AM -0800, Guido van Rossum wrote: That is stricter than classic Python though -- it allows the value to be anything (and you get the value back unadorned in the except 's', x: clause). Thanks for the note ! Armin

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Michael Hudson
Guido van Rossum [EMAIL PROTECTED] writes: [Michael] It would still be worth doing, IMHO. Then let's do it. Care to resurrect your patch? (And yes, classic classes should also be allowed for b/w compatibility.) I found it and uploaded it here:

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Guido van Rossum
On Mon, 17 Jan 2005 11:35:53 -0500, Phillip J. Eby [EMAIL PROTECTED] wrote: At 04:06 PM 1/17/05 +, Michael Hudson wrote: a) Is Exception to be new-style? Probably not in 2.5; Martin and others have suggested that this could introduce instability for users' existing exception classes.

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Phillip J. Eby
At 10:16 AM 1/17/05 -0800, Guido van Rossum wrote: On Mon, 17 Jan 2005 11:35:53 -0500, Phillip J. Eby [EMAIL PROTECTED] wrote: At 04:06 PM 1/17/05 +, Michael Hudson wrote: a) Is Exception to be new-style? Probably not in 2.5; Martin and others have suggested that this could introduce

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Guido van Rossum
That would be much more reasonable if Exception itself was a new-style class. As long as it isn't, you'd have to declare new-style classes like this: class MyError(Exception, object): ... which is ugly. I was thinking the use case was that you were having to add 'Exception', not

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Martin v. Löwis
Guido van Rossum wrote: a) Is Exception to be new-style? Probably not in 2.5; Martin and others have suggested that this could introduce instability for users' existing exception classes. Really? I thought that was eventually decided to be a very small amount of code. I still think that only an

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-17 Thread Guido van Rossum
I still think that only an experiment could decide: somebody should come up with a patch that does that, and we will see what breaks. I still have the *feeling* that this has significant impact, but I could not pin-point this to any specific problem I anticipate. This sounds like a good

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Robey Pointer
Guido van Rossum wrote: The base of the Exception hierarchy happens to be a classic class. But why are they required to be classic? More to the point, is this a bug, a missing feature, or just a bug in the documentation for not mentioning the restriction? It's an unfortunate feature; it

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Alex Martelli
On 2005 Jan 16, at 10:27, Martin v. Löwis wrote: Simon Percivall wrote: What would happen if Exception were made a new-style class, enforce inheritance from Exception for all new-style exceptions, and allow all old-style exceptions as before. string exceptions would break. Couldn't we just

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Martin v. Löwis
Alex Martelli wrote: What would happen if Exception were made a new-style class, enforce inheritance from Exception for all new-style exceptions, and allow all old-style exceptions as before. string exceptions would break. Couldn't we just specialcase strings specifically, to keep

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-16 Thread Phillip J. Eby
At 10:28 AM 1/16/05 +0100, Martin v. Löwis wrote: Phillip J. Eby wrote: Couldn't we require new-style exceptions to inherit from Exception? Since there are no new-style exceptions that work now, this can't break existing code. This would require to make Exception a new-style class, right? class

[Python-Dev] Exceptions *must*? be old-style classes?

2005-01-15 Thread Jim Jewett
Phillip J. Eby wrote (in http://mail.python.org/pipermail/python-dev/2005-January/050854.html) * Classic class support is a must; exceptions are still required to be classic, and even if they weren't in 2.5, backward compatibility should be provided for at least one release. The base of the

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-15 Thread Guido van Rossum
The base of the Exception hierarchy happens to be a classic class. But why are they required to be classic? More to the point, is this a bug, a missing feature, or just a bug in the documentation for not mentioning the restriction? It's an unfortunate feature; it should be mentioned in the

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-15 Thread Simon Percivall
On 2005-01-16, at 02.57, Guido van Rossum wrote: It's been suggested that all exceptions should inherit from Exception, but this would break tons of existing code, so we shouldn't enforce that until 3.0. (Is there a PEP for this? I think there should be.) What would happen if Exception were made a

Re: [Python-Dev] Exceptions *must*? be old-style classes?

2005-01-15 Thread Phillip J. Eby
At 05:57 PM 1/15/05 -0800, Guido van Rossum wrote: It's been suggested that all exceptions should inherit from Exception, but this would break tons of existing code, so we shouldn't enforce that until 3.0. (Is there a PEP for this? I think there should be.) Couldn't we require new-style exceptions