[issue16627] comparison problem of two 'dict' objects

Singer Song report at bugs.python.org
Thu Dec 6 12:29:27 CET 2012


New submission from Singer Song:

#python code:
a={600072:1, 80000880:2, 600243:3, 600495:4, 80002529:5}
b={600072:1, 80000880:2, 600243:3, 80002529:5, 600495:4}
print(a)
print(b)
print(a==b)
print(str(a)==str(b))
print(a.keys()==b.keys())

#output in python2.7.3:
{600072: 1, 80000880: 2, 600243: 3, 80002529: 5, 600495: 4}
{600072: 1, 80000880: 2, 600243: 3, 600495: 4, 80002529: 5}
True
False
False

#output in python3.2.3:
{600072: 1, 80000880: 2, 600243: 3, 80002529: 5, 600495: 4}
{600072: 1, 80000880: 2, 600243: 3, 600495: 4, 80002529: 5}
True
False
True

#two questions:
1)str(a) and str(b) are different, why?
2)keys method returns different result between python2.7.3 and python3.2.3

----------
components: Interpreter Core
messages: 177039
nosy: singer
priority: normal
severity: normal
status: open
title: comparison problem of two 'dict' objects
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16627>
_______________________________________


More information about the Python-bugs-list mailing list