king kikapu a écrit :
> Hi,
> 
> i am trying, to no avail yet, to take a C#'s overloaded functions
> skeleton and rewrite it in Python by using closures.
> I read somewhere on the net (http://dirtsimple.org/2004/12/python-is-
> not-java.html) that in Python we can reduce code duplication for
> overloaded functions by using closures.

Then you should re-read more carefully this article. While closures are 
effectively a great way to reduce code duplication, they are by no mean 
presented as a way to replace function overloading - or at least not 
directly[1]. The idea presented here is to use closures to write 
functions that will return "parameterized" functions, and (IMHE at 
least) this is mostly useful in frameworks, ORMs and like.

[1] you may want to have a look at another work by the same author:
http://peak.telecommunity.com/DevCenter/VisitorRevisited
which introduces the RuleDispatch generic function package.

HTH
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to