On Aug 29, 6:50 am, Roland Puntaier <[EMAIL PROTECTED]
automation.com> wrote:
> def changeOne(aa,idx):
> aa[idx]=not aa[idx]
> yield aa
> for i in range(idx):
> for x in changeOne(aa,i):
> yield x
>
> def changeOneOrder(aa):
> yield aa
> for i in range(len(aa)):
> for x in c
> #this does not return the way I would expect. why?
You yield the very same list object all the times. So
when you make a later change, all earlier results will
get changed, too (since they are the same object).
Of course, it won't affect the terminal output, so you
don't see that the older value
No greeting, no text? Pity.
Roland Puntaier wrote:
> def changeOne(aa,idx):
> aa[idx]=not aa[idx]
> yield aa
> for i in range(idx):
> for x in changeOne(aa,i):
> yield x
>
> def changeOneOrder(aa):
> yield aa
> for i in range(len(aa)):
> for x in changeOne(aa,i):
>