[Python-Dev] Dict suppressing exceptions (original) (raw)
Michael Chermside mcherm at mcherm.com
Fri Aug 11 14:37:06 CEST 2006
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc bug?
- Next message: [Python-Dev] Elementtree and Namespaces in 2.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido writes:
Alas, I have no idea what it does. Can you come up with an example that doesn't require enums and localization?
Sorry. Here's the short version:
Fact 1: Sometimes people create objects that raise exceptions when compared for equality. Maybe it's a bad idea to do this, and objects should never raise exceptions when compared except to signal internal inconsistancy -- but the practice is common enough to show up in a 5-star recipe for enums in the Cookbook.
Fact 2: Unrelated objects are often put in dictionarys together. I used a "localization dictionary" as an example. I feel this is a legitimate practice.
If dictionarys stop suppressing exceptions raised by equality tests then those two facts aren't compatible. Programs that used to work fine will break with 2.4. I'm OK with your proposed solution (fix the case of str-unicode but let everyone else using objects that raise exceptions suffer), but I think it would be more friendly to use warnings for now and exceptions after another full release cycle. The warnings should solve the underlying issue (hard-to-debug problems).
-- Michael Chermside
- Previous message: [Python-Dev] PyThreadState_SetAsyncExc bug?
- Next message: [Python-Dev] Elementtree and Namespaces in 2.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]