OK, don't change it. :-)

On Fri, Feb 7, 2014 at 1:53 PM, Yury Selivanov <yselivanov...@gmail.com>wrote:

>
> On 2/7/2014, 4:47 PM, Guido van Rossum wrote:
>
>> >And one more, aesthetic question: the currently agreed on signature of
>>> >exception handlers is '(loop, context)'. I have a method
>>> >"BaseEventLoop.default_exception_handler(self, context)", but when the
>>> >method is bound, its signature is just '(context)', hence, this bound
>>> >method cannot be passed to 'set_exception_handler'. Should the
>>> signature be
>>> >"BaseEventLoop.default_exception_handler(self, loop, context)", or can
>>> I
>>> >just make it a staticmethod with '(loop, context)'?
>>> >
>>>
>> But why would you want to pass the default handler to
>> set_exception_handler()? I had expected that there would be something like
>> this:
>>
>> def call_exception_handler(self, exception, context):
>>      if self._exception_handler is not None:
>>          try:
>>              self._exception_handler(self, exception, context)
>>              return
>>          except Exception as exc:
>>              self.default_exception_handler(exc, {'message': 'custom
>> exception handler failed'})
>>          self.default_exception_handler(exception, context)
>>
> That's almost exactly the code I currently have.
>
> And the question is rather rhetorical: i.e. if it's OK to pass
> "loop.default_exception_handler" to "loop.set_exception_handler" [1]
> or it shouldn't be used that way, always use
> "loop.set_exception_handler(None) [2]". I like the [2], and that's
> how I have it implemented now, but wanted to confirm it with the list.
>
> Yury
>



-- 
--Guido van Rossum (python.org/~guido)

Reply via email to