mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Update qhelp
This commit is contained in:
13
python/ql/src/Functions/examples/IterReturnsNonSelf.py
Normal file
13
python/ql/src/Functions/examples/IterReturnsNonSelf.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class MyRange(object):
|
||||
def __init__(self, low, high):
|
||||
self.current = low
|
||||
self.high = high
|
||||
|
||||
def __iter__(self):
|
||||
return (self.current, self.high) # BAD: does not return `self`.
|
||||
|
||||
def __next__(self):
|
||||
if self.current > self.high:
|
||||
return None
|
||||
self.current += 1
|
||||
return self.current - 1
|
||||
Reference in New Issue
Block a user