Why this apparent assymetry in set operations?

Chris M chris.monsanto at gmail.com
Tue Jan 15 12:06:42 EST 2008


On Jan 15, 11:51 am, "Neil Cerutti" <mr.ceru... at gmail.com> wrote:
>
> So this is a bug in set_update or in set_ior. They can't both be
> right.
>

It's not a bug.

"Note, the non-operator versions of union(), intersection(),
difference(), and symmetric_difference(), issubset(), and issuperset()
methods will accept any iterable as an argument. In contrast, their
operator based counterparts require their arguments to be sets. This
precludes error-prone constructions like set('abc') & 'cbs' in favor
of the more readable set('abc').intersection('cbs')."



More information about the Python-list mailing list