[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Python Tutorial Was: Guido's regrets: filter and map
From:       "John Roth" <johnroth () ameritech ! net>
Date:       2002-11-30 14:45:04
[Download RAW message or body]


"Louis M. Pecora" <pecora@anvil.nrl.navy.mil> wrote in message
news:291120020841221805%pecora@anvil.nrl.navy.mil...
> In article <3DE49902.BE880724@alcyone.com>, Erik Max Francis
> <max@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?

That would be true if your sequence type inherited from one
of the existing sequence types. Most classes that implement
(parts of) the sequence interface don't do that.

John Roth
>
> --
> Lou Pecora
>   - My views are my own.


-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic