intersection and union idea
Tim Peters
tim.one at home.com
Mon Jul 23 20:41:12 EDT 2001
[Neil Macneale]
> I was day dreaming about python today, and I realized that it would be
> very python-ish to have intersection and union operators for lists and
> tuples. Eg:
>
> >>> (1,2,3,4) | (1,3,6,8)
> (1,2,3,4,6,8)
> >>> (1,2,3,4) & (1,3,6,8)
> (1,3)
>
> Does such an operator exist? I am sure someone else has thought of this
> before.
No and yes. A feeble subset of set operations isn't worth the bother of
adding ("gratuitous bloat"), so the best hope for this kind of thing is in
PEP 218:
http://python.sourceforge.net/peps/pep-0218.html
a-lot-of-bloat-is-always-better-than-a-little<wink>-ly y'rs - tim
More information about the Python-list
mailing list