Unyeilding a permutation generator

Paul Rubin http
Sun Nov 2 17:00:49 EST 2008


sillyhat at yahoo.com writes:
> Anyway what I want to do is experiment with code similar to this (i.e.
> same algorithm and keep the recursion) in other languages,
> particularly vbscript and wondered what it would look like if it was
> rewritten to NOT use the yield statement - 

Without the yield statement and keeping the same space complexity, you
basically have to wrap the enumeration state in a data object that you
can enumerate over explicitly.  That in turn may mean you have to
unwind the recursion into old fashioned stack operations.



More information about the Python-list mailing list