On Sat, 31 Jul 2010 11:31:49 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
However, the simpler approach is just to recommend that single-dispatch generic functions default to a particular method. "magic method" vs "generic function" isn't actually an either-or decision: it is quite possible to have the latter rely on the former in its default "unrecognised type" implementation, while still providing the type registration infrastructure that allows an application to say "no, I don't want that behaviour in this case, I want to do something different".
Ah, right. That sounds much more appealing.
To be honest, there are actually some more features I would want to push for in ABCs (specifically, a public API to view an ABC's type registry, as well as a callback API to be notified of registration changes) before seriously proposing an official generic function implementation in the standard library.
Would be nice, indeed. Regards Antoine.