oren-py-l at hishome.net
Mon Jul 7 12:34:26 CEST 2003
On Wed, Jun 25, 2003 at 11:38:51PM +0200, Gerrit Holl wrote:
> 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)])
More information about the Python-list