Ryan Freckleton <ryan.freckle...@gmail.com> added the comment:

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>

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5135>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to