Re: Strange generator problem
On 05/10/2007 11:34, Paul Hankin wrote: > Lists aren't copied when they're yielded, Duh! Thanks for your sharp eye. -- Joost Cassee http://joost.cassee.net -- http://mail.python.org/mailman/listinfo/python-list
Strange generator problem
Hello all, I bumped into an unexpected problem using generators. Consider this code: def test(s): return _test([], [], s) def _test(s1, s2, s): if s: s1.append(s.pop()) for x in _test(s1, s2, s): yield x s2.append(s1.pop()) for x in _test(s1, s