This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dohertywa
Recipients dohertywa
Date 2007-10-16.20:27:29
SpamBayes Score 0.0001365589
Marked as misclassified No
Message-id <1192566451.3.0.9845024568.issue1288@psf.upfronthosting.co.za>
In-reply-to
Content
Hello:

I'm am trying to conduct some tests on a list of data that checks for
the position of values in list elements using the bisect module.  To
store the results of these tests for output to a template I have build a
dictionary with 47 keys the values of which are dictionaries themselves.
 These inner dictionaries contain 7 keys that initially are valued at
zero.  Looping through the data in my list I check for values from 1 to
47 and if I find the value I am looking for I lookup it's position in
the row using the bisect module.  Using the current value I am looking
for and the position returned from bisect I increase the value in the
matching dictionary key value position by 1. Now for speed I have built
the dictionary using d =
dict.fromkeys(xrange(1,48),dict.fromkeys(xrange(1,8),0)) as this gives
the desired result.  Unfortunately when I run my test for values each
value in the dictionary is listed as the total number of rows in the
data list.  This is not the desired result which is correctly achieved
using:
d = {}
for x in xrange(1,48):
    d[x] = dict.fromkeys(xrange(1,8),0)

I have included output from IDLE to demonstrate the problem.
Files
File name Uploaded
problem-report.txt dohertywa, 2007-10-16.20:27:29
History
Date User Action Args
2007-10-16 20:27:31dohertywasetspambayes_score: 0.000136559 -> 0.0001365589
recipients: + dohertywa
2007-10-16 20:27:31dohertywasetspambayes_score: 0.000136559 -> 0.000136559
messageid: <1192566451.3.0.9845024568.issue1288@psf.upfronthosting.co.za>
2007-10-16 20:27:31dohertywalinkissue1288 messages
2007-10-16 20:27:30dohertywacreate