On Sat, Nov 22, 2008 at 17:53, Vinay Sajip <[EMAIL PROTECTED]> wrote:
> Sidnei da Silva <sidnei <at> enfoldsystems.com> writes:
>
>> I do have one suggestion for improvement: instead of requiring the
>> person to do this monkey patching, add a new 'log' action to the
>> warnings filter as described by PEP 230 [1] (see: 'The Warnings
>> Filter' section). This way, changing the behavior of how warnings are
>> displayed (or not) is kept consistent and documented.
>>
>> [1] http://www.python.org/dev/peps/pep-0230/
>>
>
> I see from PEP-230 the following under "Rejected Concerns" stated by GvR:
>
> "Paul Prescod, Barry Warsaw and Fred Drake have brought up several additional
> concerns that I feel aren't critical.  I address them here (the concerns are
> paraphrased, not exactly their words):"
>
>    [other concerns omitted]
>    - Barry: I'd like to add my own warning action.  Maybe if `action'
>      could be a callable as well as a string.  Then in my IDE, I
>      could set that to "mygui.popupWarningsDialog".
>
>      Response: For that purpose you would override warnings.showwarning().
>    [other concerns omitted]
>
> So, monkey-patching appears to be the suggested approach. Indeed, ISTM that 
> the
> showwarning function is there specifically for the purpose of being
> monkey-patched out.
>

It is specifically there to be overridden (and as an aside, it was a
pain to support in the C port of warnings), so it really isn't
monkey-patching. =)

-Brett
_______________________________________________
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