odd question

Konstantin Veretennicov kveretennicov at yahoo.com
Fri Jul 16 13:36:15 EDT 2004


Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> wrote in message news:<40f6b35a$0$6541$636a15ce at news.free.fr>...
> Harald Massa wrote:
> > 
> I thought anyone using a programming language had at least some notions 
> of boolean algrebra...

Actually my first guess was set operations :)

>>> from sets import Set
>>> f2(Set('one'), Set('two'), Set('three'))
Set(['e', 't', 'o'])

f2 returns set of items that are common for at least two sets (i, j, k).
If you draw it on paper you'll get a nice shamrock leaf :)
You can also apply it to integers, which are sets of bits.

- kv



More information about the Python-list mailing list