New submission from Paul Moore <p.f.mo...@gmail.com>: This patch takes the existing "simplegeneric" decorator, currently an internal implementation detail of the pkgutil module, and exposes it as a feature of the functools module.
Documentation and tests have been added, and the pkgutil code has been updated to use the functools implementation. Open issue: The syntax for registering an overload is rather manual: def xxx_impl(xxx): pass generic_fn.register(XXX, xxx_impl) It might be better to make the registration function a decorator: @generic_fn.register(XXX) def xxx_impl(xxx): pass However, this would involve changing the existing (working) code, and I didn't want to do that before there was agreement that the general idea (of exposing the functionality) was sound. ---------- assignee: ncoghlan components: Library (Lib) files: generic.patch keywords: needs review, patch messages: 80986 nosy: ncoghlan, pmoore priority: normal severity: normal stage: patch review status: open title: Expose simplegeneric function in functools module type: feature request versions: Python 2.7 Added file: http://bugs.python.org/file12921/generic.patch _______________________________________ 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