M.-A. Lemburg wrote:
> Michael Chermside wrote:
>>> How about we change unicode-vs-str __eq__ to
>>> issue a warning (and return False) instead of raising
>>> UnicodeException?
>>       [... Marc-Andre Lemburg agrees ...]
>>> Great! Now we need someone to volunteer to write a patch (which should
>>> include doc and NEWS updates) in time for beta 3 (Aug 18).
>> I don't *strongly* object to this consensus, but if you haven't
>> glanced at my original example, take a look - it might convince you.
>> The proposed solution will not help with my example. I'm not sure the
>> motivation for breaking code like that example -- the bug-hunting
>> motivation is satisfied by issuing a warning as Michael Urman proposes,
>> then use an exception after one more release when people have had time
>> to fix their code.
> 
> The warning framework gives programmers great flexibility in handling
> these situation:
> 
> * they can silence the warning, just report it once, always report it
> * they can have the warning raise an exception
> * they can log the warning in some way
> 
> It's very flexible to accommodate for all kinds of ways to handle
> the situation.
> 
> By introducing a new category of warning for these Unicode-related
> warnings, adding specific warning filters will be easy.

This sounds like the correct tool to me. +1

Would it be possible to generate warnings when either Unicode or stings 
are coerced to the other implicitly but not explicitly?

That may also generate a warning in the case of the dictionary problem 
being discussed, (I think), and may be more useful for checking for 
non-intentionally mixed Unicode and strings.

Ron


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to