Re: Help with sets

2010-10-14 Thread Steve Howell
On Oct 14, 9:22 pm, Lawrence D'Oliveiro wrote: > In message > <12fcd67a-774d-42f0-851a-9c3497df9...@s24g2000pri.googlegroups.com>, Steve > > Howell wrote: > > On Oct 14, 4:09 pm, Gregory Ewing wrote: > >> Steve Howell wrote: > > >> Maybe "analogy" or "similarity" would be a better word here. > >

Re: Help with sets

2010-10-14 Thread Lawrence D'Oliveiro
In message <12fcd67a-774d-42f0-851a-9c3497df9...@s24g2000pri.googlegroups.com>, Steve Howell wrote: > On Oct 14, 4:09 pm, Gregory Ewing wrote: >> Steve Howell wrote: >> >> Maybe "analogy" or "similarity" would be a better word here. > > Agreed. "Analogy" seems particularly appropriate. Excep

Re: Help with sets

2010-10-14 Thread Steve Howell
On Oct 14, 4:09 pm, Gregory Ewing wrote: > Steve Howell wrote: > > That was the original context of my comment.  The term "symmetry" gets > > used a couple times in that PEP, and I think we're in violent > > agreement that the concept of "symmetry" is wishy-washy at best. > > > Here is just one ex

Re: Help with sets

2010-10-14 Thread Gregory Ewing
Steve Howell wrote: That was the original context of my comment. The term "symmetry" gets used a couple times in that PEP, and I think we're in violent agreement that the concept of "symmetry" is wishy-washy at best. Here is just one example from the PEP: The symmetry between "if x in y

Re: Help with sets

2010-10-13 Thread Steve Howell
On Oct 13, 7:25 pm, Lawrence D'Oliveiro wrote: > In message > , Steve > > Howell wrote: > > I guess a lot depends on how you define "symmetry."  Is your > > definition of "symmetry" equivalent to your definition of > > "orthogonality"? > > No idea. It’s just that the example being discussed in thi

Re: Help with sets

2010-10-13 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > I guess a lot depends on how you define "symmetry." Is your > definition of "symmetry" equivalent to your definition of > "orthogonality"? No idea. It’s just that the example being discussed in this thread seemed to come under the old term “orthogonality”, so

Re: Help with sets

2010-10-13 Thread Steve Howell
On Oct 13, 4:27 pm, Lawrence D'Oliveiro wrote: > In message > <57a322df-8e42-4da5-af96-0c21c5733...@b14g2000pro.googlegroups.com>, Steve > > Howell wrote: > > Lawrence, I was actually talking about symmetry, not orthogonality. > > So what’s the difference? I don't think there's a big difference b

Re: Help with sets

2010-10-13 Thread Lawrence D'Oliveiro
In message <57a322df-8e42-4da5-af96-0c21c5733...@b14g2000pro.googlegroups.com>, Steve Howell wrote: > Lawrence, I was actually talking about symmetry, not orthogonality. So what’s the difference? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with sets

2010-10-12 Thread MRAB
On 13/10/2010 02:40, Steve Howell wrote: On Oct 12, 5:54 pm, Lawrence D'Oliveiro wrote: In message, D'Arcy J.M. Cain wrote: On Tue, 12 Oct 2010 23:34 +1300 Lawrence D'Oliveiro wrote: Symmetry is always a tricky balance in programming languages. Is that what we used to call “orthogonali

Re: Help with sets

2010-10-12 Thread Steve Howell
On Oct 12, 5:54 pm, Lawrence D'Oliveiro wrote: > In message , D'Arcy > > J.M. Cain wrote: > > On Tue, 12 Oct 2010 23:34 +1300 > > Lawrence D'Oliveiro wrote: > > >>> Symmetry is always a tricky balance in programming languages. > > >> Is that what we used to call “orthogonality”? > > > No, orthogo

Re: Help with sets

2010-10-12 Thread Lawrence D'Oliveiro
In message , D'Arcy J.M. Cain wrote: > On Tue, 12 Oct 2010 23:34 +1300 > Lawrence D'Oliveiro wrote: > >>> Symmetry is always a tricky balance in programming languages. >> >> Is that what we used to call “orthogonality”? > > No, orthogonality is something else. "Orthogonal" means "perpendicula

Re: Help with sets

2010-10-12 Thread D'Arcy J.M. Cain
On Tue, 12 Oct 2010 23:34 +1300 Lawrence D'Oliveiro wrote: > > Symmetry is always a tricky balance in programming languages. > > Is that what we used to call “orthogonality”? No, orthogonality is something else. "Orthogonal" means "perpendicular to." See the Wikipedia article for a discussion

Re: Help with sets

2010-10-12 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > Symmetry is always a tricky balance in programming languages. Is that what we used to call “orthogonality”? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with sets

2010-10-11 Thread Steve Howell
On Oct 11, 5:11 pm, Gregory Ewing wrote: > Robert Kern wrote: > > The reasoning for this decision is spelled out in the PEP introducing > > the iterator feature: > > >  http://www.python.org/dev/peps/pep-0234/ > > There's also the question of whether 'if x in dict' should > compare keys only or bo

Re: Help with sets

2010-10-11 Thread Gregory Ewing
Robert Kern wrote: The reasoning for this decision is spelled out in the PEP introducing the iterator feature: http://www.python.org/dev/peps/pep-0234/ There's also the question of whether 'if x in dict' should compare keys only or both keys and values. This was also hotly debated back whe

Re: Help with sets

2010-10-11 Thread Robert Kern
On 10/11/10 6:11 AM, Lawrence D'Oliveiro wrote: In message<8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: Lawrence D'Oliveiro wrote: Did you know that applying the “set” or “frozenset” functions to a dict return a set of its keys? Seems a bit dodgy, somehow. That's just a consequ

Re: Help with sets

2010-10-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message <8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: Lawrence D'Oliveiro wrote: Did you know that applying the “set” or “frozenset” functions to a dict return a set of its keys? Seems a bit dodgy, somehow. That's just a consequence of the fact tha

Re: Help with sets

2010-10-11 Thread Lawrence D'Oliveiro
In message <8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: > Lawrence D'Oliveiro wrote: > >> Did you know that applying the “set” or “frozenset” functions to a dict >> return a set of its keys? > >> Seems a bit dodgy, somehow. > > That's just a consequence of the fact that dicts produce

Re: Help with sets

2010-10-08 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: Did you know that applying the “set” or “frozenset” functions to a dict return a set of its keys? Seems a bit dodgy, somehow. That's just a consequence of the fact that dicts produce their keys when iterated over, and the set constructor iterates over whatever you

Re: Help with sets

2010-10-06 Thread Lawrence D'Oliveiro
In message <87bp79qdhk@rudin.co.uk>, Paul Rudin wrote: > Certainly you can model a set as a dictionary, but that's likely to be > less efficient than using a set, and quite possibly you'll need to roll > your own operations on your sets, whereas they're provided for the built > in implementati

Re: Help with sets

2010-10-05 Thread Terry Reedy
On 10/5/2010 3:39 AM, Steven D'Aprano wrote: Sets aren't an alternative to dictionaries. They have a completely different purpose. A dict/mapping is a specialized set -- a set of ordered pairs in which each first member (the 'key') only appears once as a first member. The set union of two ma

Re: Help with sets

2010-10-05 Thread Terry Reedy
On 10/5/2010 3:01 AM, Ian Kelly wrote: self._pos = {predicate: {object: {subject: None}}} That's a bit ugly because the None serves no purpose here; the value associated with the subject has no meaning in this context. This is what we did in Python before sets were added. > It also useless

Re: Help with sets

2010-10-05 Thread nn
> Semantic web.  I did get a bit confused in reading about the concept of > sets in python and why you would use them instead of a dictionary for Sets are faster and more convenient to do intersections, unions, differences. They also use less space than dictionaries. Finally they also help conveyi

Re: Help with sets

2010-10-05 Thread Paul Rudin
"B. M. Whealton" writes: > I did get a bit confused in reading about the concept of sets in > python and why you would use them instead of a dictionary for example. Use a set when something is naturally modelled as a set... it's a collection of unordered objects that you can test for membership,

Re: Help with sets

2010-10-05 Thread Steven D'Aprano
On Mon, 04 Oct 2010 22:31:50 -0400, B. M. Whealton wrote: > I did get a bit confused in reading about the concept of > sets in python and why you would use them instead of a dictionary for > example. Why would you use a spoon instead of a paper clip? Why would you use a hat-stand instead of a pe

Re: Help with sets

2010-10-05 Thread Chris Rebert
On Tue, Oct 5, 2010 at 12:01 AM, Ian Kelly wrote: > On Mon, Oct 4, 2010 at 8:31 PM, B. M. Whealton > wrote: >> >> self._pos = {predicate:{object:set([subject])}} >> >>       We have the first dictionary keyed off the first term, the second >> dictionary keyed off the second term, and the set cont

Re: Help with sets

2010-10-05 Thread Ian Kelly
On Mon, Oct 4, 2010 at 8:31 PM, B. M. Whealton < bwheal...@futurewavedesigns.com> wrote: > self._pos = {predicate:{object:set([subject])}} > > We have the first dictionary keyed off the first term, the second > dictionary keyed off the second term, and the set containing the third > terms(no

Help with sets

2010-10-04 Thread B. M. Whealton
Hello all, So, I started learning python just recently. I got inspired by a project that related to the semantic web. I can see why this would be a language chosen for the applications that help to build the semantic web. It is interesting to see that indeed python does have structures