<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>> We are not going to change the implementation of sets so fundamentally,
<br>> mostly because having O(1) behaviors is so nice (add, remove, membership
<br>> check, etc).<br><br>What I want are such interfaces (no matter with standard set):<br>    class IDynSet:<br>        # "Dyn" means it have methods like ipop_both<br>        def ipop_both(self):<br>            if hasattr(self, 'pop_mutable'):<br>                elem = self.pop_mutable()<br>            elif hasattr(self, 'ipop_immutable'):<br>                elem, self = self.ipop_immutable()<br>            else: raise<br>            return elem, self<br><br>    class IMutableDynSet(IDynSet):<br>        def pop_mutable(self):<br>            return self.pop()<br><br>    class IImutableDynSet(IDynSet):<br>        def ipop_immutable(self):<br>            elem, new = self.ipop() # ipop not pop<br>            return elem, new<br><br><br><span id="transmark" style="display: none; width: 0px; height: 0px;"></span><br></div></div><br><br><span title="neteasefooter"><p> </p></span>