[Tutor] dictionary question

David Driver count0.djd at gmail.com
Thu Jul 28 18:24:00 CEST 2005


The following code:

print str(dict(a=1,b=2,c=-1))
print str(dict(a=1,c=-1,b=2))
print str(dict(c=-1,a=1,b=2))
print str(dict(b=2,a=1,c=-1))
print str(dict(b=2,c=-1,a=1))
print
print str(dict(a=1,b=2,c=23))
print str(dict(a=1,c=23,b=2))
print str(dict(c=23,a=1,b=2))
print str(dict(b=2,a=1,c=23))
print str(dict(b=2,c=23,a=1))
print
print str(dict(a=1,b=2,c='booga'))
print str(dict(a=1,c='booga',b=2))
print str(dict(c='booga',a=1,b=2))
print str(dict(b=2,a=1,c='booga'))
print str(dict(b=2,c='booga',a=1))

Produces:

{'a': 1, 'c': -1, 'b': 2}
{'a': 1, 'c': -1, 'b': 2}
{'a': 1, 'c': -1, 'b': 2}
{'a': 1, 'c': -1, 'b': 2}
{'a': 1, 'c': -1, 'b': 2}

{'a': 1, 'c': 23, 'b': 2}
{'a': 1, 'c': 23, 'b': 2}
{'a': 1, 'c': 23, 'b': 2}
{'a': 1, 'c': 23, 'b': 2}
{'a': 1, 'c': 23, 'b': 2}

{'a': 1, 'c': 'booga', 'b': 2}
{'a': 1, 'c': 'booga', 'b': 2}
{'a': 1, 'c': 'booga', 'b': 2}
{'a': 1, 'c': 'booga', 'b': 2}
{'a': 1, 'c': 'booga', 'b': 2}

Could I rely on creating hashes to use as keys in bsddb this way? If I
create a dictionary with the same keys, will it str the same way?

Thanks!
-- 

***********************************
See there, that wasn't so bad.
***********************************


More information about the Tutor mailing list