November 18, 2004
Generic Functions In Python

from Jacobus de Teramo's Das Buch Belial, 1473

Phillip Eby is adding generic functions to Python [via LtU]. It looks like you can do both type- and predicate- dispatch, and there's some support for different types of method combination.

From a short guide of how to use generic functions as an alternative to the Visitor pattern:

Lisp developers have been occasionally known to sneer at the Visitor pattern as a non-solution to a non-problem. Aside from any general tendency for Lisp programmers to sneer at things (ahem!), this is probably because with the Common Lisp Object System (CLOS), they have a delightful thing called a “generic function”.

The decorator syntax is a little weird, but this looks like the beginning of a powerful new feature for Python. Now if someone could just add easy, powerful macros.

Posted by jjwiseman at November 18, 2004 01:20 PM
Comments
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?