Bug: dictionary with >= 8192 keys not initialized correctly
gbreed at cix.compulink.co.uk
gbreed at cix.compulink.co.uk
Thu Aug 10 08:54:10 EDT 2000
In article <8ms8n6$3n9$1 at nnrp1.deja.com>, rwgk at my-deja.com () wrote:
> Save this to a file dictbug.py:
>
> print 'd1 = {'
> for i in xrange(8191):
> print str(i) + ': None,'
> print '}'
> print 'd2 = {'
> for i in xrange(8192):
> print str(i) + ': None,'
> print '}'
> print 'print len(d1)'
> print 'print len(d2)'
>
> Then run:
>
> python dictbug.py > tmp.py
> python tmp.py
>
> The output is:
>
> 8191
> 0
It works if you remove the comma after the last entry. Something like:
for i in xrange(8191):
print str(i) + ': None,'
print '8191: None'
No idea why. This is with 1.5.2 on Windows95
Graham
More information about the Python-list
mailing list