[issue32380] functools.singledispatch interacts poorly with methods

2019-03-27 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset bc284f0c7a9a7a9a4bf12c680823023a6770ce06 by Inada Naoki in branch 
'master':
bpo-32380: add "versionadded: 3.8" to singledispatchmethod (GH-12580)
https://github.com/python/cpython/commit/bc284f0c7a9a7a9a4bf12c680823023a6770ce06


--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2019-03-27 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +12524

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-05-28 Thread Ethan Smith


Ethan Smith  added the comment:

This was fixed, so I think it can be closed.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-05-26 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c651275afe8515b2cf70b8152e19ce39df88f0dd by Łukasz Langa (Ethan 
Smith) in branch 'master':
bpo-32380: Create functools.singledispatchmethod (#6306)
https://github.com/python/cpython/commit/c651275afe8515b2cf70b8152e19ce39df88f0dd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-04-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

+1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-03-29 Thread Nick Coghlan

Nick Coghlan  added the comment:

Added Łukasz to the nosy list, as I'd like his +1 before accepting this change 
(I do still think it's a good idea, for the same reasons we added 
partialmethod).

--
nosy: +lukasz.langa, ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-03-29 Thread Ethan Smith

Change by Ethan Smith :


--
versions: +Python 3.8 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2018-03-29 Thread Ethan Smith

Change by Ethan Smith :


--
pull_requests: +6024

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2017-12-22 Thread Ethan Smith

Change by Ethan Smith :


--
keywords: +patch
pull_requests: +4873
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2017-12-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

I have also noticed this problem and I like the idea. It appeared some time ago 
on python-ideas, but no one has written a patch.

--
nosy: +levkivskyi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32380] functools.singledispatch interacts poorly with methods

2017-12-19 Thread Ethan Smith

New submission from Ethan Smith :

Consider the following:

from functools import singledispatch

class Dispatch:
@singledispatch
def foo(self, a):
return a

@foo.register(int)
def _(self, a):
return "int"

@foo.register(str)
def _(self, a):
return "str"

cls = Dispatch()
cls.foo(3)  # 3
cls.foo('hm')  # 'hm'

I find this quite unintuitive. Essentially, since singledispatch dispatches 
based solely on a functions first argument, it is useless on methods unless one 
wraps it and modifies how it uses the internal wrapper function. I believe this 
should be relatively easy to fix with adding a check of inspect.ismethod and 
then modifying the number of the checked argument where appropriate.

I'm happy to write a patch if this change is seen as a good idea.

--
components: Library (Lib)
messages: 308687
nosy: Ethan Smith
priority: normal
severity: normal
status: open
title: functools.singledispatch interacts poorly with methods
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com