PageRenderTime 20ms CodeModel.GetById 2ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/python/std_map/runme.py

#
Python | 82 lines | 52 code | 29 blank | 1 comment | 20 complexity | 00c52a94b8e7ac1ad8634b045fe5285e MD5 | raw file
 1# file: runme.py
 2
 3import example
 4
 5pmap = example.pymap()
 6pmap["hi"] = 1
 7pmap["hello"] = 2
 8
 9
10
11
12dmap = {}
13dmap["hello"] = 1.0
14dmap["hi"] = 2.0
15
16print dmap.items()
17print dmap.keys()
18print dmap.values()
19
20print dmap
21hmap = example.halfd(dmap)
22dmap = hmap
23
24print dmap
25for i in dmap.iterkeys():
26    print "key", i
27
28for i in dmap.itervalues():
29    print "val", i
30
31for k,v in dmap.iteritems():
32    print "item", k,v
33
34dmap = example.DoubleMap()
35dmap["hello"] = 1.0
36dmap["hi"] = 2.0
37
38for i in dmap.iterkeys():
39    print "key", i
40
41for i in dmap.itervalues():
42    print "val", i
43
44for k,v in dmap.iteritems():
45    print "item", k,v
46
47
48print dmap.items()
49print dmap.keys()
50print dmap.values()
51
52hmap = example.halfd(dmap)
53print hmap.keys()
54print hmap.values()
55
56
57
58dmap = {}
59dmap["hello"] = 2
60dmap["hi"] = 4
61
62hmap = example.halfi(dmap)
63print hmap
64print hmap.keys()
65print hmap.values()
66
67
68dmap = hmap
69
70for i in dmap.iterkeys():
71    print "key", i
72
73for i in dmap.itervalues():
74    print "val", i
75
76for i in dmap.iteritems():
77    print "item", i
78
79for k,v in dmap.iteritems():
80    print "item", k,v
81
82print dmap