This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients ncoghlan, paul.moore
Date 2009-02-02.19:57:33
SpamBayes Score 3.2185247e-07
Marked as misclassified No
Message-id <1233604660.52.0.0984436233806.issue5135@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-02-02 19:57:40paul.mooresetrecipients: + paul.moore, ncoghlan
2009-02-02 19:57:40paul.mooresetmessageid: <1233604660.52.0.0984436233806.issue5135@psf.upfronthosting.co.za>
2009-02-02 19:57:38paul.moorelinkissue5135 messages
2009-02-02 19:57:37paul.moorecreate