[Python-ideas] unify usage of mutable and immutable objects

David Mertz mertz at gnosis.cx
Tue Feb 28 12:23:54 EST 2017


On Tue, Feb 28, 2017 at 5:59 AM, 语言破碎处 <mlet_it_bew at 126.com> wrote:

> bad example:
>     a = set()
>     a.add(1)        # return None; "a" changed
>     e = a.pop();
>

That is simply misspelled for your intent.

a = set()

a |= {1}

e = a.pop()



-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170228/48633a72/attachment.html>


More information about the Python-ideas mailing list