Skip to content

keshprad/py-polymorphic-list

Repository files navigation

py-polymorphic-list

Publish to PyPI Deploy docs to GitHub Pages

Python implementation of a polymorphic list

View on PyPI / Documentation / GitHub Source Code

What is a Polymorphic List?

A polymorphic list is a data abstraction similar to LinkedLists where objects of two classes, NonEmptyList, and EmptyList, are employed to cleanly handle edge cases where a LinkedList would be null. In a LinkedList, the last node's next reference is null; however, for a PolymorphicList, the last node's next reference is an EmptyList, allowing the EmptyList object to override methods defined in a PolymorphicList.

This means that every method is overridden to have a version for a NonEmptyList and for an EmptyList.

Installation

pip install py-polymorphic-list

Or install with pip3, accordingly.

Documentation

Check out the documentation for full details on usage.