wangjun / sdict

Automatically exported from code.google.com/p/sdict
0 stars 0 forks source link

Silently converts your keys to strings #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> d = sdict.Dict()
>>> d[0] = 0
>>> d.keys()
['0000000000']
>>> type(d.keys()[0])
<type 'str'>

What is the expected output? What do you see instead?

Integer key should be an integer, not a string.

What version of the product are you using? On what operating system?

Python 2.7.2, Mac OS X 10.7.3

Please provide any additional information below.

Original issue reported on code.google.com by davidwtb...@gmail.com on 15 Mar 2012 at 12:02

GoogleCodeExporter commented 9 years ago
in sdict, int if converted to string at first, using str(i).zfill(10). because 
the core data structure used in sdict is "Ternary Search Tree", which is 
designed for string searching.

However, we can walk around this problem at python-level. I will fix it soon.

Original comment by ccnu...@gmail.com on 15 Mar 2012 at 1:29

GoogleCodeExporter commented 9 years ago

Original comment by ccnu...@gmail.com on 15 Mar 2012 at 1:45

GoogleCodeExporter commented 9 years ago

Original comment by ccnu...@gmail.com on 15 Mar 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by ccnu...@gmail.com on 15 Mar 2012 at 1:56