Skip to main content

Store data in JSON format

Project description

A simple function to generate a simple filtered dict where a dict is created based on a dictionary and a function. The returned dict contains all the kwargs if the passed function which are present in the inut dict.
This is espacially useful if you have a dict with more keys than needed to call a function or you call a function by reference and want to pass an dict as kwargs


d = dict(a=0,b=1,s1="foo",s2="bar") 
def merge_strings(s1="",s2=""):
    return s1+s2

#throws TypeError: merge_strings() got an unexpected keyword argument 'a'

# returns foobar as expected

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FilterDict-0.2.1575457091.tar.gz (2.5 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page