473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

sets.filter?

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?

yours,
Gerrit.

--
2. If any one bring an accusation against a man, and the accused go to
the river and leap into the river, if he sink in the river his accuser
shall take possession of his house. But if the river prove that the
accused is not guilty, and he escape unhurt, then he who had brought the
accusation shall be put to death, while he who leaped into the river shall
take possession of the house that had belonged to his accuser.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/

Jul 18 '05 #1
1 2216
Gerrit Holl <ge****@nl.linux.org> wrote in message news:<ma**********************************@python. org>...
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?


Yes, it'd be a great idea. filter/map/reduce should've been methods
on sequences from the beginning.

Jeremy
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mickel Grönroos | last post by:
Hi! Are there any standard list methods for getting the intersection and difference of two lists? (The union is easy ("list1.extend(list2)"), unless you want it to contain unique values.) ...
9
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after...
0
by: Dave Benjamin | last post by:
Hola, I made a backport of sets.py that will run on Jython 2.1. Here is a diff against the Python 2.3 version of sets.py. The changes were simple, but I may have made a mistake here or there,...
7
by: Steve | last post by:
This post has two parts. First is my feedback on sets. (Hello? Last summer called, they want their discussion thread back...) Second is some questions about my implementation of a partition...
15
by: les_ander | last post by:
Hi, I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the...
2
by: Andy Dingley | last post by:
I have a publishing application. The database layer queries various sources and produces an XML document, then XSLT processes this into HTML or RSS. In this particular case, there are several...
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
4
by: brian | last post by:
I tried opening 2 readers with the same connection and soon found out that can't be done. I found out I need to use a data set because that is a disconnected set. Can someone tell me how to...
13
by: Amit Khemka | last post by:
Hello, Is there a *direct* way of doing set operations on lists which preserve the order of the input lists ? For Ex. l1 = l2 = and (l1 intersect l2) returns .... (and (l2 intersect...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.