How to use 'python for loop dict' in Python

Every line of 'python for loop dict' 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
365def FOR(self, node):
366 """
367 Process bindings for loop variables.
368 """
369 vars = []
370 def collectLoopVars(n):
371 if hasattr(n, 'name'):
372 vars.append(n.name)
373 else:
374 for c in n.getChildNodes():
375 collectLoopVars(c)
376
377 collectLoopVars(node.assign)
378 for varn in vars:
379 if (isinstance(self.scope.get(varn), Importation)
380 # unused ones will get an unused import warning
381 and self.scope[varn].used):
382 self.report(messages.ImportShadowedByLoopVar,
383 node.lineno, varn, self.scope[varn].source.lineno)
384
385 self.handleChildren(node)

Related snippets