New submission from axw: This simple snippet demonstrates the misbehaviour. Confirmed on two amd64 machines, python 2.7.3.
################### import copy uzlist = [u'abc', u'def', u'ghj', u'klm', u'zxc'] utzdict = {u'abc':1, u'def':2, u'ghj':3, u'klm':4, u'zxc':5} utemplist = copy.copy(uzlist) for m in utemplist: if m in utzdict.keys(): utemplist.remove(m) # utemplist should be empty now - it is not! >>> utemplist [u'def', u'klm'] utemplist = copy.copy(uzlist) for i in range(len(uzlist)): try: if utzdict[ uzlist[i] ]: utemplist.remove( uzlist[i] ) except KeyError: pass # utemplist should be empty now. This time it is: >>> utemplist [] ---------- components: Interpreter Core, Unicode messages: 167645 nosy: axw, ezio.melotti priority: normal severity: normal status: open title: some unicode keys not found using in dictionary.keys() type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15579> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com