Skip to Content
Secret Recipes of the Python Ninja
book

Secret Recipes of the Python Ninja

by Cody Jackson
May 2018
Intermediate to advanced content levelIntermediate to advanced
380 pages
9h 37m
English
Packt Publishing
Content preview from Secret Recipes of the Python Ninja

Looking at the collections – extended module

If you search PyPI, you will find the collections-extended module (https://pypi.python.org/pypi/collections-extended/1.0.0). Collections-extended expands the number of collections types available.

The following classes are included:

  • bag: It is equivalent to a multiset, bags build upon the default set container by allowing multiple instances of the bag's elements.

A bag (also called a multiset in other languages) generalizes the concept of a set so that it allows multiple instances of elements. For example, {a, a, b}, and {a, b} are different bags, but part of the same set. Only hashable elements can be used in a bag. An important point about bags is the multiplicity of elements. Multiplicity ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Expanding World of Python

The Expanding World of Python

Dane Hillard

Publisher Resources

ISBN: 9781788294874Supplemental Content