Skip to content

7omb/nonempty

Repository files navigation

non-empty lists for Python

Inspired by Haskell this library provides a NonEmpty class. NonEmpty mimics the API for normal Python lists:

from nonempty import NonEmpty

n = NonEmpty(1)
n.append(2)
n.extend([3])
n.pop()

However, it is not allowed to remove the last element of a non-empty list.