homepage

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 Jiba
Recipients Jiba
Date 2012年05月16日.09:51:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337161894.62.0.255300061013.issue14828@psf.upfronthosting.co.za>
In-reply-to
Content
In some situation, itertools.groupby fails to group the objects, and produces several groups with the same key. For example, the following code :
from itertools import *
class P(object):
 def __init__(self, key):
 self.key = key
p1 = P(1)
p2 = P(2)
p3 = P(1)
for key, ps in groupby([p1, p2, p3], lambda p: p.key):
 print "group", key
 for p in ps:
 print " - object", p
Produces the following result :
group 1
 - object <__main__.P object at 0xb73d6acc>
group 2
 - object <__main__.P object at 0xb73d6aec>
group 1
 - object <__main__.P object at 0xb73d6b0c>
While I would expect to have only a single group 1, e.g. something like :
group 1
 - object <__main__.P object at 0xb73d6acc>
 - object <__main__.P object at 0xb73d6b0c>
group 2
 - object <__main__.P object at 0xb73d6aec>
It seems that this bug also affects Python 3 (tested on Python 3.1.2)
History
Date User Action Args
2012年05月16日 09:51:34Jibasetrecipients: + Jiba
2012年05月16日 09:51:34Jibasetmessageid: <1337161894.62.0.255300061013.issue14828@psf.upfronthosting.co.za>
2012年05月16日 09:51:34Jibalinkissue14828 messages
2012年05月16日 09:51:33Jibacreate

AltStyle によって変換されたページ (->オリジナル) /