[Python-Dev] PEP 443 - Single-dispatch generic functions
Terry Jan Reedy
tjreedy at udel.edu
Thu May 23 01:16:01 CEST 2013
I like the general idea. Does you have any specific stdlib use cases in
mind?
I thought of pprint, which at some point dispatches on dict versus
set/sequence, but overall it seems more complicated than mere arg type
dispatch.
Unittest.TestCase.assertEqual mostly (but not completely) uses first arg
dispatch based on an instance-specific dict, and it has an custom
instance registration method addTypeEqualityFunc. (Since each test_xxx
runs in a new instance, a registration for multiple methods has to be
done either in a setup method or repeated in each test_method.)
Terry
More information about the Python-Dev
mailing list