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

语言破碎处 mlet_it_bew at 126.com
Tue Feb 28 17:57:15 EST 2017

> To me, 'pop' implies mutation. Tuples do not have a pop method, and it
> is not obvious to me that either tuples or frozensets should. What are > the use cases that are not better served by converting to list or set?
> --
> Terry Jan Reedy

1) coverting to set or list is O(n) in time
2) if I have to keep the old copy,
    standard set solution will be O(n) both in time and space!

working examples:
    1) priority queue:
        insert and pop occur
    2) share immutable data to difference subroutines:
        each one can modify local copy safely and concurrency.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170301/ec958bc9/attachment.html>

More information about the Python-ideas mailing list