Ask coding questions

← Back to all posts
Iterating with For loops and maybe while
proryan

How do you delete the prevoius yield before printing the next yield. Like before you print hello2 delete hello1.

PLEASE ANSWER FAST!!!

Link to example: is https://Iterating-with-For-loops-and-maybe-while.proryan.repl.co/stream

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
proryan
Comments
hotnewtop
Coder100

this way the yield is global and not dependent on a single request

proryan

@Coder100 No that doesn't work :(

Coder100

maybe make the yields different? Right now they all return hello and there is no way for you to differentiate what is what @proryan

Coder100

@proryan

proryan

@Coder100 Nope, still doesn't work :(

Coder100
proryan

@Coder100 No, I don't think you understand, it has to delete the previous yielded value before showing the next...

Coder100

oh, well the thing is in HTTP requests that's not possible. What you have written you cannot remove. You must close the connection and make a new one. @proryan

Coder100

have you ever noticed how there is no delete method in flask? The reason is because it just isn't in the protocol. Use something like js in the frontend to achieve the 'effect' @proryan

proryan

@Coder100 Yes, I know, I was just wondering if their was anyway to do it with flask...

Coder100

it's not in the protocol it isn't supported at all much less flask @proryan

proryan

@Coder100 ok 😢

Coder100

:(
also mark as correct answer? @proryan

proryan

@Coder100 I mean technically you didn't solve it but I'm nice 👍

Coder100

you can't solve something that can't be solved
thanks @proryan

Coder100

move the function outside of the scope.