[Talin]
> I've been using generators to implement backtracking search for a while
> now. Unfortunately, my code is large and complex enough (doing
> unification on math expressions) that its hard to post a simple
> example. So I decided to look for a simpler problem that could be used
> to demonstr
Alex Martelli wrote:
> for x in whatever_other_iterable: yield x
>
> into (say)
>
> yield from whatever_other_iterable
>
> is minute and not worth changing the syntax (even though something like
> 'yield from' would mean no keywords would need to be added).
I agree that the improvement is minor,
>>for pos in qsearch( pos ):
>> yield pos
> Um - do you really want to reuse the variable pos here? Yeah, it
> works, but this strikes me as very confusing. I'm not sure that it
> might not be implementation dependent.
Certainly not. pos is - and that
"Talin" <[EMAIL PROTECTED]> wrote:
> I've been using generators to implement backtracking search for a while
> now. Unfortunately, my code is large and complex enough (doing
> unification on math expressions) that its hard to post a simple
> example. So I decided to look for a simpler problem that
"Talin" <[EMAIL PROTECTED]> writes:
> As an alternative, I'd like to present the following implementation. If
> you compare this one with the one in lib/test/test_generator.py you
> will agree (I hope) that by using recursive generators to implement
> backtracking, the resulting code is a little mo
Talin <[EMAIL PROTECTED]> wrote:
> even simpler - for examle, the idea of being able to return the output
> of one generator directly from another instead of having to iterate
> through all of the results and then re-yield them has already been
> discussed in this forum.
I missed those discussion
I've been using generators to implement backtracking search for a while
now. Unfortunately, my code is large and complex enough (doing
unification on math expressions) that its hard to post a simple
example. So I decided to look for a simpler problem that could be used
to demonstrate the technique