diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-11-02 10:54:13 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-11-02 10:54:13 +0200 |
commit | 2828885db093be86ef5b2c58f5c05ac3c4ed3664 (patch) | |
tree | 8185b82968b220aa543936e45be34fc239a5c8ea /uitools/KWDict.py | |
download | slime-2828885db093be86ef5b2c58f5c05ac3c4ed3664.tar.gz |
Diffstat (limited to 'uitools/KWDict.py')
-rw-r--r-- | uitools/KWDict.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/uitools/KWDict.py b/uitools/KWDict.py new file mode 100644 index 0000000..3fddac0 --- /dev/null +++ b/uitools/KWDict.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +###################################################################### +# This module provides a means of converting a keyword argument list +# to a dictionary. Thank you, "Internet Programming With Python". +# +# Mitch Chapman +#--------------------------------------------------------------------- +# $Log: KWDict.py,v $ +# Revision 1.1 1996/12/01 22:58:54 mchapman +# Initial revision +# +###################################################################### + +__version__ = "$Revision: 1.1 $" + +###################################################################### +# Build a dictionary using keyword notation. Include only items +# whose values are not None. +###################################################################### +def dict(**kw): + result = {} + for k, v in kw.items(): + if v != None: + result[k] = v + return result + + +###################################################################### +# Main function for unit testing. +###################################################################### +def main(): + return + +if __name__ == "__main__": + main() |