On Jan 15, 2008 11:07 AM, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > > Why is that? Doesn't the |= operator essentially map to an update() call? > > > > No, according to 3.7 Set Types, s | t maps to s.union(t). > > I was asking about the |= assignment operator which according to the > docs *does* map to the update method.
Oops! You're right. That's surprising. This inconsistency is due to the c implementation. Internally, |= maps to the c function set_ior, while .update(...) maps to set_update. Both eventually call set_update_internal, which works fine when the operand is not a set. But set_ior specifically punts non-sets before calling set_update_internal. So this is a bug in set_update or in set_ior. They can't both be right. -- Neil Cerutti <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list