( list pop())and the ability to have slices on the left-hand side of an assignmentto provide insertionreplacementand deletion of slices lists are ideal for holding sequences of itemsespecially if we need fast access by index position when we discussed the set and frozenset typeswe noted that they may contain only hashable items sets provide fast membership testing and are useful for filtering out duplicate data dictionaries are in some ways similar to sets--for exampletheir keys must be hashable and are unique just like the items in set but dictionaries hold key-value pairswhose values can be of any type the dictionary coverage included the dict get(and dict setdefault(methodsand the coverage of default dictionaries showed an alternative to using these methods like setsdictionaries provide very fast membership testing and fast access by key listssetsand dictionaries all offer compact comprehension syntaxes that can be used to create collections of these types from iterables (which themselves can be comprehensions)and with conditions attached if required the range(and zip(functions are frequently used in the creation of collectionsboth in conventional for in loops and in comprehensions items can be deleted from the mutable collection types using the relevant methodssuch as list pop(and set discard()or using delfor exampledel [kto delete an item with key from dictionary python' use of object references makes assignment extremely efficientbut it also means that objects are not copied when the assignment operator (=is used we saw the differences between shallow and deep copyingand later on saw how lists can be shallow-copied using slice of the entire listl[:]and how dictionaries can be shallow-copied using the dict copy(method any copyable object can be copied using functions from the copy modulewith copy copy(performing shallow copyand copy deepcopy(performing deep copy we introduced python' highly optimized sorted(function this function is used lot in python programmingsince python doesn' provide any intrinsically ordered collection data typesso when we need to iterate over collections in sorted orderwe use sorted(python' built-in collection data types--tupleslistssetsfrozen setsand dictionaries--are sufficient in themselves for all purposes nonethelessa few additional collection types are available in the standard libraryand many more are available from third parties we often need to read in collections from filesor write collections to files in this we focused just on reading and writing lines of text in our very brief coverage of text file handling full coverage of file handling is given in and additional means of providing data persistence is covered in