You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Version Information
Currently Vyper allows range expressions of the form
range(x, x + n)
wheren
is a constant. A weird case happens whenx
is 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).The text was updated successfully, but these errors were encountered: