Initial proposal: New for statement
- View SourceDefine new looping construct
for item from generator:
(generator = any object callable without parameters)
new_for_stmt: "for" target_list "from" expression_list ":" suite
["else" ":" suite]
The expression list is evaluated once; it should yield a object
callable without parameters.
Then callable object is called forever. On each call returned values
are assigned to the target list using the standard rules for
assignments, and then the suite is executed. Callable object can
break loop raiseing predefined exception.
.... (as for .. in)
Clearly overlay for..in with this semantic.
So for..in meaning going to be:
Support for iterators, but this is open ...
- View SourceNo, no, no. No new statements.
--Guido van Rossum (home page: http://www.python.org/~guido/)