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 ryan.freckleton
Recipients doerwalter, ncoghlan, paul.moore, ryan.freckleton
Date 2009-02-05.03:30:06
SpamBayes Score 8.264047e-07
Marked as misclassified No
Message-id <1233804617.11.0.115711783268.issue5135@psf.upfronthosting.co.za>
In-reply-to
Content
I think that registering existing functions is an important use case, so
I vote for keeping the non-decorator version of register.

Another thing that we may want to document is that [simple]generic
doesn't dispatch based on registered abstract base classes.

>>> class A:
...     pass
...
>>> class C:
...     __metaclass__ = abc.ABCMeta
...
>>> C.register(A)
>>> @generic
... def pprint(obj):
...     print str(obj)
...
>>> @pprint.register(C)
... def pprint_C(obj):
...     print "Charlie", obj
...
>>> pprint(C())
Charlie <__main__.C object at 0xb7c5336c>
>>> pprint(A())
<__main__.A instance at 0xb7c5336c>
History
Date User Action Args
2009-02-05 03:30:17ryan.freckletonsetrecipients: + ryan.freckleton, doerwalter, paul.moore, ncoghlan
2009-02-05 03:30:17ryan.freckletonsetmessageid: <1233804617.11.0.115711783268.issue5135@psf.upfronthosting.co.za>
2009-02-05 03:30:09ryan.freckletonlinkissue5135 messages
2009-02-05 03:30:07ryan.freckletoncreate