Difference between revisions of "Python collections"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
https://docs.python.org/3/library/collections.html | https://docs.python.org/3/library/collections.html | ||
− | |||
− | |||
− | |||
+ | This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple. | ||
+ | * namedtuple() factory function for creating tuple subclasses with named fields | ||
+ | |||
+ | * [[deque]] list-like container with fast appends and pops on either end | ||
+ | |||
+ | * ChainMap dict-like class for creating a single view of multiple mappings | ||
+ | |||
+ | * Counter dict subclass for counting hashable objects | ||
+ | |||
+ | * OrderedDict dict subclass that remembers the order entries were added | ||
+ | |||
+ | * defaultdict dict subclass that calls a factory function to supply missing values | ||
+ | |||
+ | * UserDict wrapper around dictionary objects for easier dict subclassing | ||
+ | |||
+ | * UserList wrapper around list objects for easier list subclassing | ||
+ | |||
+ | * UserString wrapper around string objects for easier string subclassing | ||
+ | |||
+ | |||
+ | |||
+ | == Related == | ||
* [[Python collection: deque (double-ended queue)]] | * [[Python collection: deque (double-ended queue)]] | ||
== See also == | == See also == | ||
* {{Python collections}} | * {{Python collections}} | ||
+ | * {{Data structures}} | ||
* {{Python}} | * {{Python}} | ||
[[Category:Python]] | [[Category:Python]] |
Latest revision as of 05:12, 13 November 2024
https://docs.python.org/3/library/collections.html
This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.
- namedtuple() factory function for creating tuple subclasses with named fields
- deque list-like container with fast appends and pops on either end
- ChainMap dict-like class for creating a single view of multiple mappings
- Counter dict subclass for counting hashable objects
- OrderedDict dict subclass that remembers the order entries were added
- defaultdict dict subclass that calls a factory function to supply missing values
- UserDict wrapper around dictionary objects for easier dict subclassing
- UserList wrapper around list objects for easier list subclassing
- UserString wrapper around string objects for easier string subclassing
Related[edit]
See also[edit]
- Python collections
- Data structures:
queue
,list, linked list
,stack
,trie
, Abstract data structures, Python collections, Hash table - Python, PIP, GIL, Flask, Django, Marshmallow,
def
, logging, Pandas, Numpy, AWS Chalice,import
,from
,tuple
,list
, Python exceptions,virtualenv
,.append
,pytz
,TZ
,print
,python3 -c
,os
, PEP, Python Institute, Methods: Dunder methods, Flake8, Python collections, Function decorators in Python, Click python library, Python module, Flower,kwargs
, Black (Python), Python list structure, Mypy,variables
, Casting,try:
, pydoc, argparse, Anaconda,pyenv, setup.py, python3 --version, python3 --help
, Data Classes, raise
Advertising: