New submission from Pyry Pakkanen <frostb...@suomi24.fi>: The following self-referencing generator has incorrect output:
def ab_combinations(): #'', 'a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', ... def _deferred_output(): yield "" tees = tee(output) #This definition works fine: '', 'a', 'b', 'aa', 'ab', 'ba', ... l = [(item+"a" for item in tees[0]), (item+"b" for item in tees[1])] #This definition results in: '', 'b', 'b', 'bb', 'bb', 'bb', ... #l = [(item+label for item in t) for t, label in zip(tees,"ab")] while True: for g in l: yield next(g) result, output = tee(_deferred_output()) return result ---------- messages: 149403 nosy: PyryP priority: normal severity: normal status: open title: Weird behavior with generators with self-referencing output. type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13595> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com