Version Information
Currently Vyper allows range expressions of the form range(x, x + n) where n is a constant. A weird case happens when x is impure:
glob: int128
@public
def foo() -> int128:
self.glob += 1
return 5
@public
def bar():
for i in range(self.foo(), self.foo() + 1):
pass
Even though the range expression contains two calls to self.foo() it is only executed once, which feels very unintuitive at best. In general, it would be nice to have some documentation for loops/range expressions (especially if this is the intended behavior).
Version Information
Currently Vyper allows range expressions of the form
range(x, x + n)wherenis a constant. A weird case happens whenxis impure:Even though the range expression contains two calls to
self.foo()it is only executed once, which feels very unintuitive at best. In general, it would be nice to have some documentation for loops/range expressions (especially if this is the intended behavior).