Python

sumtype

Latest version: v0.10.0.post4

PyUp actively tracks 460,489 Python packages for vulnerabilities to keep your Python environments secure.

Scan your dependencies

0.11.b0

We only ever need one `None`, `()`, etc. After this update, variants with no payload (i.e. `Nothing` from `Maybe[A]`) can behave that way: we do `Maybe.Nothing` (access the singleton immutable value) instead of `Maybe.Nothing()` (create a new instance). This is enabled with the new `constants` option:
python
class Maybe(sumtype, constants=True):
def Just(val): ...
Nothing = … new syntax

or by inheriting from `sumtype.future.sumtype` instead of `sumtype.sumtype` (This will be the default behavior after 1.0).

Note: it isn't currently guaranteed that there only ever exists one `Maybe.Nothing` - currently, `_replace()`, `.__copy__()` etc. will produce another instance, so you shouldn't rely on the `is` operator. This may or may not change in the future.

0.10.0.post4

Fixed code-block indentation in the README, because it looked bad on PyPI

0.10.0.post2

Fixed typo in README

0.10.0.post1

Added missing `typeguard` dependency to setup.py

0.10.0

Added field typechecking based on annotations (see README)