<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>> A hypothetical frozenset.pop() is also necessarily O(N).  It needs to 
copy N-1 elements into the new (smaller) frozenset object.  So this 
isn't an argument.<br>Pop tuple/frozenset(standard one) gain no benefit. # O(n)<br>It is a different story for balanced tree. # O(log n)<br></div><br><div>> Sounds like `collections.deque` might be what you want (for concurrency,
 not for immutability).  But a local copy will require, by definition, a
 *copy* operation either way.<br>My intent is to unify "SET" interface, not for to using deque.<br>     I want something that is SET can use anywhere regardless mutable or not.<br>    <span id="transmark" style="display: none; width: 0px; height: 0px;"></span>And the idiom SHOULD work for other type.<br><br>WHY set.add / list.sort return None?<br>     if return self,  someone may think it don't modify the orignal object.<br>     so, mutable object will have different methods.<br>Such differences are good UNLESS we want to ignore it explictly.<br>We need a uniform way to make a interface suitable for both cases. <br><br></div><br><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br>At 2017-03-01 07:14:33, "David Mertz" <mertz@gnosis.cx> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 28, 2017 at 2:57 PM, ÓïÑÔÆÆËé´¦ <span dir="ltr"><<a href="mailto:mlet_it_bew@126.com" target="_blank">mlet_it_bew@126.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><span class=""><div>1) coverting to set or list is O(n) in time<br></div></span></div></blockquote><div><br></div><div>A hypothetical frozenset.pop() is also necessarily O(N).  It needs to copy N-1 elements into the new (smaller) frozenset object.  So this isn't an argument.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><span class=""><div></div></span><div>2) if I have to keep the old copy,<br>    standard set solution will be O(n) both in time and space!<br></div></div></blockquote><div><br></div><div>Again, nothing gained here. Same applies to frozenset.pop() (assuming it returns both the item popped and a reduced set).  If you just want "something from frozenset" without creating a new almost-copy frozenset, that is spelled `next(iter(fs))`.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>working examples:<br>    1) priority queue:<br>        insert and pop occur<br>    2) share immutable data to difference subroutines:<br>        each one can modify local copy safely and concurrency.<br></div></div></blockquote><div><br></div><div>Sounds like `collections.deque` might be what you want (for concurrency, not for immutability).  But a local copy will require, by definition, a *copy* operation either way. </div></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons.  Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span>