Python's collections Tutorial
Python's collections: A Buffet of Specialized Data Types
VonTran A
Dieses E-Book entspricht möglicherweise nicht den Standards zur Barrierefreiheit und ist eventuell nicht vollständig mit unterstützenden Technologien kompatibel.
Python's collections: A Buffet of Specialized Data Types
Python’s collections module provides a rich set of specialized container data types carefully designed to approach specific programming problems in a Pythonic and efficient way. The module also provides wrapper classes that make it safer to create custom classes that behave similar to the built-in types dict, list, and str.
Learning about the data types and classes in collections will allow you to grow your programming tool kit with a valuable set of reliable and efficient tools.
In this tutorial, you’ll learn how to:
• Write readable and explicit code with namedtuple
• Build efficient queues and stacks with deque
• Count objects quickly with Counter
• Handle missing dictionary keys with defaultdict
• Guarantee the insertion order of keys with OrderedDict
• Manage multiple dictionaries as a single unit with ChainMap
To better understand the data types and classes in collections, you should know the basics of working with Python’s built-in data types, such as lists, tuples, and dictionaries. Additionally, the last part of the article requires some basic knowledge about object-oriented programming in Python.
Details
- Veröffentlicht am
- Oct 18, 2023
- Sprache
- English
- Kategorie
- Ingenieurwissenschaft
- Copyright
- Alle Rechte vorbehalten - Standard-Urheberrechtslizenz
- Autoren/Mitwirkende
- Von (Autor): Tran A
Spezifikationen
- Format
- EPUB