
Phillip J. Eby wrote:
At 09:58 AM 2/27/04 -0500, Phillip J. Eby wrote:
At 12:40 AM 2/27/04 -0500, Glyph Lefkowitz wrote: Not at the moment. What I'd like to do at some point is add single-dispatch generic functions, though.
Just for the heck of it, I thought I'd try whipping up a single-dispatch generic function using PyProtocols. It turned out to be much easier than I thought; only 19 lines, in fact!
# Quick test/demo ...
def gA(ob): print ob, "is an A" g.add(gA,[A]) def gB(ob): print ob, "is a B" g.add(gB,[B])
Wow. glyph explained to me what he wanted before with the no-instantiation IFoo.meth(x), but I didn't realize that it really _is_ like generic functions. That's awesome. :-) -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/