官术网_书友最值得收藏!

  • Mastering Python
  • Rick van Hattem
  • 159字
  • 2021-07-16 11:10:33

Chapter 3. Containers and Collections – Storing Data the Right Way

Python comes bundled with several very useful collections, a few of which are basic Python collection data types. The rest are advanced combinations of these types. In this chapter, we will explain some of these collections, how to use them, and the pros and cons of each of them.

Before we can properly discuss data structures and the related performance, a basic understanding of time complexity (and specifically the big O notation) is required. No need to worry! The concept is really simple, but without it, we cannot easily explain the performance characteristics of operations.

Once the big O notation is clear, we will discuss the basic data structures:

  • list
  • dict
  • set
  • tuple

Building on the basic data structures, we will continue with more advanced collections, such as the following:

  • Dictionary-like types:
    • ChainMap
    • Counter
    • Defaultdict
    • OrderedDict
  • List types:
    • Deque
    • Heapq
  • Tuple types:
    • NamedTuple
  • Other types:
    • Enum
主站蜘蛛池模板: 灵川县| 攀枝花市| 永善县| 恭城| 天台县| 富顺县| 义乌市| 温州市| 固安县| 双鸭山市| 铜梁县| 临沭县| 九江县| 绥芬河市| 青田县| 大同县| 沁水县| 防城港市| 高密市| 保定市| 莲花县| 上高县| 江城| 铜鼓县| 岫岩| 松阳县| 宝丰县| 聂拉木县| 泗阳县| 凤翔县| 辽宁省| 双辽市| 武清区| 普宁市| 双柏县| 深州市| 独山县| 田林县| 长沙市| 阳原县| 桓台县|