[Python-ideas] Add MutableSet.update?

Chris Barker chris.barker at noaa.gov
Sat Mar 10 17:45:59 EST 2018


On Sat, Mar 10, 2018 at 3:24 AM, MRAB <python at mrabarnett.plus.com> wrote:

> On 2018-03-10 01:15, Guido van Rossum wrote:
>
>> Yes, you can use the |= operator instead.
>>
>> |= is not quite the same as .update because it rebinds,


isn't that an "in-place operator" i.e. if it's a mutable object it should
mutate rather than rebinding?

-CHB




> so if the name on the LHS isn't local it'll raise NameError.
>
> Does that matter?
>
>
> On Fri, Mar 9, 2018 at 4:48 PM, Lucas Wiman <lucas.wiman at gmail.com
>> <mailto:lucas.wiman at gmail.com>> wrote:
>>
>>     I was trying to use `collections.abc.MutableSet` today, and noticed
>>     that it does not define an `update` method. This is a very useful
>>     method that is present on the builtin `set` class, and seems to fit
>>     naturally with the other methods.
>>
>>     Was omitting this method intentional?
>>
>>     Thanks & best wishes,
>>     Lucas Wiman
>>
>> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180310/cf823e34/attachment.html>


More information about the Python-ideas mailing list