Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 7:02 AM, Nick Coghlan wrote: > On 28 December 2017 at 04:22, Ethan Smith wrote: > > Okay, if there is no further feedback, I will work on a > singledispatchmethod > > decorator like partialmethod. > > > > For the future perhaps, would it not be possible to tell that the p

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-29 Thread Nick Coghlan
On 28 December 2017 at 04:22, Ethan Smith wrote: > Okay, if there is no further feedback, I will work on a singledispatchmethod > decorator like partialmethod. > > For the future perhaps, would it not be possible to tell that the passed > argument is a descriptor/function and dispatch to the corre

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-27 Thread Ethan Smith
Okay, if there is no further feedback, I will work on a singledispatchmethod decorator like partialmethod. For the future perhaps, would it not be possible to tell that the passed argument is a descriptor/function and dispatch to the correct implementation, thus not needing two functions for essen

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-26 Thread Ivan Levkivskyi
On 26 December 2017 at 01:41, Nick Coghlan wrote: > On 25 December 2017 at 12:32, Ethan Smith wrote: > > So at the moment, I don't think it is possible to implement > singledispatch > > on classmethod or staticmethod decorated functions. > > I've posted this to the PR, but adding it here as well

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-25 Thread Nick Coghlan
On 25 December 2017 at 12:32, Ethan Smith wrote: > So at the moment, I don't think it is possible to implement singledispatch > on classmethod or staticmethod decorated functions. I've posted this to the PR, but adding it here as well: I think this is a situation very similar to the case with fun

[Python-Dev] Supporting functools.singledispatch with classes.

2017-12-24 Thread Ethan Smith
Hello all, In https://bugs.python.org/issue32380 I was hoping to add support for singledispatch with methods. Unfortunately, this cannot be achieved internally without ugly attribute or stack hacks. Therefore, I was thinking it would be nice if singledispatch supported a keyword argument of the a