Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-20 Thread skip
>> * New method (proposed by Shane Holloway): s1.isdisjoint(s2). Mike> +1. Disjointness verification is one of my main uses for set(), Mike> and though I don't think that the early-out condition would Mike> trigger often in my code, it would increase readability. I think the

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-19 Thread Martin v. Löwis
>> I'd rather see iterator versions of the set operations. > > Interesting idea. I'm not sure I see how to make it work. > If s|t returned an iterator, then how would s|t|u work? I don't think s.union(t) should return an iterator, if for no other reason than compatibility. Instead, there might

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-19 Thread Raymond Hettinger
>> * New method (proposed by Shane Holloway): s1.isdisjoint(s2). >> Logically equivalent to "not s1.intersection(s2)" but has an >> early-out if a common member is found. [MvL] > I'd rather see iterator versions of the set operations. Interesting idea. I'm not sure I see how to make it work.

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-19 Thread Giovanni Bajo
On 19/05/2007 3.34, Raymond Hettinger wrote: > * Make sets listenable for changes (proposed by Jason Wells): > > s = set(mydata) > def callback(s): > print 'Set %d now has %d items' % (id(s), len(s)) > s.listeners.append(callback) > s.add(existing_element) # no call

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-19 Thread Martin v. Löwis
> * New method (proposed by Shane Holloway): s1.isdisjoint(s2). > Logically equivalent to "not s1.intersection(s2)" but has an > early-out if a common member is found. The speed-up is potentially > large given two big sets that may largely overlap or may not > intersect at all. There is also a m

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-18 Thread Aaron Brady
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Raymond > Hettinger > Sent: Friday, May 18, 2007 8:35 PM > To: python-dev@python.org > Subject: [Python-Dev] Py2.6 buildouts to the set API > > Here some ideas that

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-18 Thread Aahz
On Fri, May 18, 2007, Raymond Hettinger wrote: > > Here some ideas that have been proposed for sets: > > * New method (proposed by Shane Holloway): s1.isdisjoint(s2). > Logically equivalent to "not s1.intersection(s2)" but has an early-out > if a common member is found. The speed-up is potentiall

Re: [Python-Dev] Py2.6 buildouts to the set API

2007-05-18 Thread Mike Klaas
On 18-May-07, at 6:34 PM, Raymond Hettinger wrote: > Here some ideas that have been proposed for sets: > > * New method (proposed by Shane Holloway): s1.isdisjoint(s2). > Logically equivalent to "not s1.intersection(s2)" but has an early- > out if a common member is found. The speed-up is po

[Python-Dev] Py2.6 buildouts to the set API

2007-05-18 Thread Raymond Hettinger
Here some ideas that have been proposed for sets: * New method (proposed by Shane Holloway): s1.isdisjoint(s2). Logically equivalent to "not s1.intersection(s2)" but has an early-out if a common member is found. The speed-up is potentially large given two big sets that may largely overlap or