Some set operators

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Oct 15 16:26:59 EDT 2005


Sometimes I suggest to add things to the language (like adding some set
methods to dicts), but I've seen that I tend to forget the meaning of
six set/frozenset operators:

s & t  s &= t
s | t  s |= t
s ^ t  s ^= t

My suggestion is to remove them, and keep them only as explicit
non-operator versions (.symmetric_difference(), .update(),
.intersection_update(), etc). But maybe now it's too much late to
remove them... Maybe someone gentle can explain me the advantage of
having/keeping them.

Thank you,
Bearophile




More information about the Python-list mailing list