NonelessDict

About

NonelessDict is a wrapper around dict that will check if a value is None/empty/False, and not add the key in that case.

The class has a method set_with_strict_none_check() that can be used to set a value and check only for None values.


NonelessOrderedDict is based NonelessDict and OrderedDict, so the order of key insertion is preserved.

Usage

API Reference

Provides frozendict, a simple immutable dictionary.

class cawdrey.nonelessdict.NonelessDict(*args, **kwds)[source]

A wrapper around dict that will check if a value is None/empty/False, and not add the key in that case. Use the set_with_strict_none_check function to check only for None

copy(**add_or_replace)[source]
dict_cls

alias of builtins.dict

set_with_strict_none_check(key, value)[source]
Return type

None

class cawdrey.nonelessdict.NonelessOrderedDict(*args, **kwds)[source]

A wrapper around OrderedDict that will check if a value is None/empty/False, and not add the key in that case. Use the set_with_strict_none_check function to check only for None

copy(*args, **kwargs)[source]
dict_cls

alias of collections.OrderedDict

set_with_strict_none_check(key, value)[source]
Return type

None