Python Tutorial Was: Guido's regrets: filter and map

Louis M. Pecora pecora at anvil.nrl.navy.mil
Fri Nov 29 08:41:22 EST 2002


In article <3DE49902.BE880724 at alcyone.com>, Erik Max Francis
<max at alcyone.com> wrote:

> Yes, it does, but it also means that everyone who ever wants to
> implement a sequence type needs to define __filter__ and __map__ methods
> (say) or you can't do filtering and mapping with them.  Filter and map
> are general algorithms over sequence types -- all you need to use them
> is iteration, which is what all sequence types have in common.

Python dummy question:  If you want them as methods, can't you just
"overload" them to output the particular sequence.  Otherwise if you
don't want to bother, you still have them as list returns.  Best of
both worlds?

-- 
Lou Pecora
  - My views are my own.



More information about the Python-list mailing list