summaryrefslogtreecommitdiff
path: root/uitools/KWDict.py
blob: 3fddac014f06a08214286e56b31a07c59c0736ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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()