[issue5135] Expose simplegeneric function in functools module

Nick Coghlan report at bugs.python.org
Wed Feb 4 12:48:09 CET 2009


Nick Coghlan <ncoghlan at gmail.com> added the comment:

The reason I like the simplegeneric name is that that is exactly what
this feature is: a *simple* generic implementation that is deliberately
limited to dispatching on the first argument (because that is easily
explained to users that are already familiar with OOP and especially the
existing Python magic method dispatch mechanism.

So the name isn't just about avoiding name clashes, it's also about
setting appropriate expectations as to what is supported. Yes, the name
is a little clumsy but one thing I do *not* want to see happen is a
swathe of feature requests asking that this become an all-singing
all-dancing generic function mechanism like RuleDispatch.

Don't forget that actually *writing* generic functions (i.e. using the
@functools.simplegeneric decorator itself) should be far less common
than using the .register() method of existing generic functions.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5135>
_______________________________________


More information about the Python-bugs-list mailing list