MCPcopy
hub / github.com/hylang/hy / iterator

Method iterator

hy/scoping.py:415–428  ·  view source on GitHub ↗

Declare an iteration variable name for this scope; as in Python, the iteration variable(s) cannot be reassigned.

(self, target)

Source from the content-addressed store, hash-verified

413 return node.node
414
415 def iterator(self, target):
416 """
417 Declare an iteration variable name for this scope; as in Python, the
418 iteration variable(s) cannot be reassigned.
419 """
420 self.iterators.update(
421 name.id for name in ast.walk(target) if isinstance(name, ast.Name)
422 )
423 # remove potentially leakable identifiers that were actually iteration
424 # variables found in `target`
425 self.assignments = [
426 node for node in self.assignments if node.name not in self.iterators
427 ]
428 self.seen = [node for node in self.seen if node.name not in self.iterators]

Callers 1

compile_comprehensionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected