Re: boolean operations on sets

2007-08-07 Thread Bruno Desthuilliers
Flavio a écrit : > Hi, I have been playing with set operations lately and came across a > kind of surprising result given that it is not mentioned in the > standard Python tutorial: > > with python sets, intersections and unions are supposed to be done > like this: > In [7]:set('casa') & set('p

Re: boolean operations on sets

2007-08-06 Thread Alex Martelli
Michael J. Fromberger <[EMAIL PROTECTED]> wrote: ... > Also, it is a common behaviour in many programming languages for logical > connectives to both short-circuit and yield their values, so I'd argue > that most programmers are proabably accustomed to it. The && and || > operators of C and it

Re: boolean operations on sets

2007-08-06 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Flavio wrote: > > > Hi, I have been playing with set operations lately and came across a > > kind of surprising result given that it is not mentioned in the > > standard Python tutorial: > > > > with python sets,

Re: boolean operations on sets

2007-08-06 Thread Stargaming
On Mon, 06 Aug 2007 14:13:51 +, Flavio wrote: > Hi, I have been playing with set operations lately and came across a > kind of surprising result given that it is not mentioned in the standard > Python tutorial: > > with python sets, intersections and unions are supposed to be done > like t

Re: boolean operations on sets

2007-08-06 Thread Diez B. Roggisch
Flavio wrote: > Hi, I have been playing with set operations lately and came across a > kind of surprising result given that it is not mentioned in the > standard Python tutorial: > > with python sets, intersections and unions are supposed to be done > like this: > In [7]:set('casa') & set('por

Re: boolean operations on sets

2007-08-06 Thread Thomas Jollans
On Monday 06 August 2007, Flavio wrote: > So My question is: Why has this been implemented in this way? I can > see this confusing many newbies... I did not implement this, so I cannot say, but it does have useful side-effects, for example: x = A or B is equivalent to: if A: x = A else: x

Re: boolean operations on sets

2007-08-06 Thread Steve Holden
Flavio wrote: > Hi, I have been playing with set operations lately and came across a > kind of surprising result given that it is not mentioned in the > standard Python tutorial: > > with python sets, intersections and unions are supposed to be done > like this: > In [7]:set('casa') & set('porc

boolean operations on sets

2007-08-06 Thread Flavio
Hi, I have been playing with set operations lately and came across a kind of surprising result given that it is not mentioned in the standard Python tutorial: with python sets, intersections and unions are supposed to be done like this: In [7]:set('casa') & set('porca') Out[7]:set(['a', 'c'])