This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients amogorkon, eryksun, ethan.furman, ncoghlan, rhettinger
Date 2016-09-06.23:43:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473205390.6.0.624579100881.issue27984@psf.upfronthosting.co.za>
In-reply-to
Content
The register() method should raise a TypeError if it's called with an object that's not a type.

Consider the following:

    from functools import singledispatch

    class C:
        pass

    obj = C()

    @singledispatch
    def foo(x):
        print(foo.dispatch(x))
        print("foo")

    @foo.register(obj)
    def bar(x):
        print(foo.dispatch(x))
        print("bar")


    >>> foo(obj)
    <function bar at 0x7f16f2adc9d8>
    foo
History
Date User Action Args
2016-09-06 23:43:10eryksunsetrecipients: + eryksun, rhettinger, ncoghlan, ethan.furman, amogorkon
2016-09-06 23:43:10eryksunsetmessageid: <1473205390.6.0.624579100881.issue27984@psf.upfronthosting.co.za>
2016-09-06 23:43:10eryksunlinkissue27984 messages
2016-09-06 23:43:10eryksuncreate