Oren Tirosh oren-py-l at
Mon Jul 7 12:34:26 CEST 2003

On Wed, Jun 25, 2003 at 11:38:51PM +0200, Gerrit Holl wrote:
> Hi,
> would it be a good idea to add a .filter() method to a set object,
> which behaves like the builtin filter() but resulting in a set?
> I often see myself doing sets.Set(filter(f, someset))... Would this
> be a good addition to sets.Set?

Considering the fact that GvR plans to eventually deprecate map and 
filter in favor of list comprehensions I doubt this kind of change would 
be accepted. I suspect his preferred idiom for this would be:

Set([x for x in someset if f(x)])

probably-not-very-good-at-channeling-Guido-ly yours,


More information about the Python-list mailing list