Python’s Collection Module: Introduction

Introduction

This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.

What types does it offer?

Following are the most commonly us…


This content originally appeared on DEV Community and was authored by Kathan Vakharia

Introduction

This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.

What types does it offer?

Following are the most commonly used special container types of collections module,

Name Purpose
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
deque list-like container with fast appends and pops on either end
namedtuple factory function for creating tuple subclasses with named fields

And...

We can also implement a custom container type like OrderedCounter using the container types provided by collections module.

The next series of posts will dive deep into the above mentioned container types provided by collections module.

Stay Tuned !


This content originally appeared on DEV Community and was authored by Kathan Vakharia


Print Share Comment Cite Upload Translate Updates
APA

Kathan Vakharia | Sciencx (2021-06-13T06:12:17+00:00) Python’s Collection Module: Introduction. Retrieved from https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/

MLA
" » Python’s Collection Module: Introduction." Kathan Vakharia | Sciencx - Sunday June 13, 2021, https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/
HARVARD
Kathan Vakharia | Sciencx Sunday June 13, 2021 » Python’s Collection Module: Introduction., viewed ,<https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/>
VANCOUVER
Kathan Vakharia | Sciencx - » Python’s Collection Module: Introduction. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/
CHICAGO
" » Python’s Collection Module: Introduction." Kathan Vakharia | Sciencx - Accessed . https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/
IEEE
" » Python’s Collection Module: Introduction." Kathan Vakharia | Sciencx [Online]. Available: https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/. [Accessed: ]
rf:citation
» Python’s Collection Module: Introduction | Kathan Vakharia | Sciencx | https://www.scien.cx/2021/06/13/pythons-collection-module-introduction/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.