Re: Replacing overloaded functions with closures.

2007-07-31 Thread king kikapu
Ok, i see... Thank you all :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Terry Reedy
"king kikapu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | > def func(obj): | > if isinstance(obj, bool): | > return not obj | > elif isinstance(obj, int): | > return obj * 2 | > elif isinstance(obj, basestring): | > return obj + obj | > else: | > raise No

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Bruno Desthuilliers
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 > over

Re: Replacing overloaded functions with closures.

2007-07-30 Thread king kikapu
> The closures discussed in the article are not a solution for > function overloading. They are a solution for function > composition. Hmmm > > Python generally has no need for function name overloading--if > you really want it you must do it manually using runtime type > checking. > > def fu

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Neil Cerutti
On 2007-07-30, king kikapu <[EMAIL PROTECTED]> wrote: > 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 co

Replacing overloaded functions with closures.

2007-07-30 Thread king kikapu
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.