7 examples of 'python while' in Python

Every line of 'python while' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
202def _while(cond, body, loop_vars, **kwargs):
203 """
204 Ensure that the condition and body of a tensorflow
205 while_loop are invoked
206 """
207
208 print("tf.while_loop")
209 cond(*loop_vars)
210 return body(*loop_vars)
500@dispatch(renpy.ast.While)
501def print_while(self, ast):
502 self.indent()
503 self.write("while %s:" % ast.condition)
504
505 self.print_nodes(ast.block, 1)
244def visit_While(self, node):
245 test = self.visit(node.test)
246 body = self.visit(node.body)
247 return IR.WhileStmt(test, body)
315def visit_while(self, node):
316 """increments the branches counter"""
317 branches = 1
318 if node.orelse:
319 branches += 1
320 self._inc_branch(node, branches)
984def p_iteration_statement_2(self, p):
985 """iteration_statement : WHILE LPAREN expr RPAREN statement"""
986 p[0] = ast.While(predicate=p[3], statement=p[5])
1016def p_expr_while(p):
1017 """expr : WHILE '(' expr eatlines ')' expr_or_assign
1018 """
1019 p[0] = While(_MakeAtom(p, 1), Cond(_MakeAtom(p, 2), p[3], _MakeAtom(p, 5)),
1020 p[6])
73def While(self, t):
74 return 'while (%s) %s' % (c_exp(t.exp), c(t.block))

Related snippets