> 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 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 NotImplementedError('type %r not supported' % type(obj)) I have already come up with that solution but i was a little excited from that article that i can do the same thing with closures...And get rid of the isinstance commands. > I'm not sure what the author was getting at, exactly. May be that point confused me too! Thanks Neil! -- http://mail.python.org/mailman/listinfo/python-list