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 axw
Recipients axw, ezio.melotti
Date 2012-08-07.22:10:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344377446.47.0.0219808809776.issue15579@psf.upfronthosting.co.za>
In-reply-to
Content
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
[]
History
Date User Action Args
2012-08-07 22:10:46axwsetrecipients: + axw, ezio.melotti
2012-08-07 22:10:46axwsetmessageid: <1344377446.47.0.0219808809776.issue15579@psf.upfronthosting.co.za>
2012-08-07 22:10:45axwlinkissue15579 messages
2012-08-07 22:10:44axwcreate