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, for-loops are simple beasts. The syntax is like this:
for NAME ITERATOR:
BODY
I want to change it to:
for NAME1 NAME2 ... in ITERABLE:
BODY
This change would consist of four changes:
Allowing multiple names for iterating over multiple values at the same time (like with Python's enumerate()).
Adding in as a pseudo-keyword to separate the names from the rest. The word in would only be treated differently in the head of a for-loop.
For-loops will work with iterables instead of iterators, which means that before the loop, the TOS will be checked for its type, and a certain iterator will be called. For lists, this will be a new version of in.
This one is less visible: the iterator will no longer get a "hidden" argument, so state will have to be kept in another way (most likely with local variables and the use of yield).
The text was updated successfully, but these errors were encountered:
Currently, for-loops are simple beasts. The syntax is like this:
I want to change it to:
This change would consist of four changes:
enumerate()
).in
as a pseudo-keyword to separate the names from the rest. The wordin
would only be treated differently in the head of a for-loop.in
.yield
).The text was updated successfully, but these errors were encountered: