omitempty

enums for Python


Keywords
library, python
License
Other
Install
pip install omitempty==0.1.1

Documentation

omitempty

Build status Coverage status Pypi package

omitempty is a Python module to remove empty keys in a dictionary. Its name comes from Go’s json package which supports an omitempty tag not to marshal empty struct fields.

The module exposes only one function that takes a dictionary and remove all keys with falsy values.

Install

[sudo] pip install omitempty

The library works with both Python 2.x and 3.x.

Usage

Import the module and use it directly:

import omitempty

d = omitempty({"a": a(), "b": b(), "c": c()})