> That is simply misspelled for your intent.
Take a look at the following function in Haskell (GHC) Data.Set
minView :: Set a -> Maybe (a, Set a)
We always want the new set after a immutable set pop().
"e = a.pop()" is fine for mutable set, but not for immutable case.
we need "e, a = a.pop()" to update "a".
在 2017-03-01 01:23:54,"David Mertz" <[email protected]> 写道:
On Tue, Feb 28, 2017 at 5:59 AM, 语言破碎处 <[email protected]> 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.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/