[Python-Dev] PEP 443 - Single-dispatch generic functions

Nick Coghlan ncoghlan at gmail.com
Fri May 24 05:57:38 CEST 2013


On Fri, May 24, 2013 at 10:31 AM, PJ Eby <pje at telecommunity.com> wrote:
> On Thu, May 23, 2013 at 6:58 PM, Ben Hoyt <benhoyt at gmail.com> wrote:
>> It seems no one has provided
>> decent use-case examples (apart from contrived ones)
>
> Um, copy.copy(), pprint.pprint(), a bunch of functions in pkgutil
> which are actually *based on this implementation already* and have
> been since Python 2.5...  I don't see how any of those are contrived
> examples.  If we'd had this in already, all the registration-based
> functions for copying, pickling, etc. would likely have been
> implemented this way, and the motivating example for the PEP is the
> coming refactoring of pprint.pprint.

We should be able to use it to help deal with the "every growing
importer API" problem, too. I know that's technically what pkgutil
already uses it for, but elevating this from "pkgutil implementation
detail" to "official stdlib functionality" should make it easier to
document properly :)

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list