Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Barry Warsaw
On Sun, 2005-04-17 at 11:53, Jack Diederich wrote: In 2.4 2.3 does it make sense to raise an exception that multiply inherits from both TypeError and AttributeError? If anyone currently does catch the error raising only AttributeError will break their code. 2.5 should just raise an

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Jack Diederich
On Sun, Apr 17, 2005 at 11:53:31AM -0400, Jack Diederich wrote: On Sat, Apr 16, 2005 at 07:24:27PM -0400, Barry Warsaw wrote: On Thu, 2005-04-14 at 23:46, Barry Warsaw wrote: I've noticed an apparent inconsistency in the exception thrown for read-only properties for C extension types vs.

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Aahz
On Sun, Apr 17, 2005, Barry Warsaw wrote: On Sun, 2005-04-17 at 11:53, Jack Diederich wrote: In 2.4 2.3 does it make sense to raise an exception that multiply inherits from both TypeError and AttributeError? If anyone currently does catch the error raising only AttributeError will break

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Guido van Rossum
In 2.4 2.3 does it make sense to raise an exception that multiply inherits from both TypeError and AttributeError? If anyone currently does catch the error raising only AttributeError will break their code. 2.5 should just raise an AttributeError, of course. I think that sets a bad

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Barry Warsaw
On Sun, 2005-04-17 at 12:25, Aahz wrote: Why is changing an exception more acceptable than creating a new one? (I don't have a strong opinion either way, but I'd like some reasoning; Jack's approach at least doesn't break code.) Especially if the new exception isn't public (in the builtins

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Barry Warsaw
On Sun, 2005-04-17 at 14:36, Guido van Rossum wrote: Personally, I think it would be fine to just change the TypeError to AttributeError. I expect that very few people would be hurt by that change (they'd be building *way* too much specific arcane knowledge into their program if they had code

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Guido van Rossum
Personally, I think it would be fine to just change the TypeError to AttributeError. I expect that very few people would be hurt by that change (they'd be building *way* too much specific arcane knowledge into their program if they had code for which it mattered). Unless there are any

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-17 Thread Barry Warsaw
On Sun, 2005-04-17 at 15:44, Guido van Rossum wrote: You meant 2.5 only of course. It's still a new feature and as such can't be changed in 2.4. Fair enough. -Barry signature.asc Description: This is a digitally signed message part ___ Python-Dev

Re: [Python-Dev] Inconsistent exception for read-only properties?

2005-04-16 Thread Barry Warsaw
On Thu, 2005-04-14 at 23:46, Barry Warsaw wrote: I've noticed an apparent inconsistency in the exception thrown for read-only properties for C extension types vs. Python new-style classes. I haven't seen any follow ups on this, so I've gone ahead and posted a patch, assigning it to Raymond:

[Python-Dev] Inconsistent exception for read-only properties?

2005-04-14 Thread Barry Warsaw
I've noticed an apparent inconsistency in the exception thrown for read-only properties for C extension types vs. Python new-style classes. I'm wondering if this is intentional, a bug, a bug worth fixing, or whether I'm just missing something. class other(object): def __init__(self, value):