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 PyryP
Recipients PyryP
Date 2011-12-13.19:25:39
SpamBayes Score 0.00101616
Marked as misclassified No
Message-id <1323804340.16.0.941499228251.issue13595@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-12-13 19:25:40PyryPsetrecipients: + PyryP
2011-12-13 19:25:40PyryPsetmessageid: <1323804340.16.0.941499228251.issue13595@psf.upfronthosting.co.za>
2011-12-13 19:25:39PyryPlinkissue13595 messages
2011-12-13 19:25:39PyryPcreate