Message81186
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> |
|
Date |
User |
Action |
Args |
2009-02-05 03:30:17 | ryan.freckleton | set | recipients:
+ ryan.freckleton, doerwalter, paul.moore, ncoghlan |
2009-02-05 03:30:17 | ryan.freckleton | set | messageid: <1233804617.11.0.115711783268.issue5135@psf.upfronthosting.co.za> |
2009-02-05 03:30:09 | ryan.freckleton | link | issue5135 messages |
2009-02-05 03:30:07 | ryan.freckleton | create | |
|