David Isaac wrote: > I would like to be able to define a loop statement > (nevermind why) so that I can write something like > > loop 10: > do_something > > instead of > > for i in range(10): > do_something > > Possible? If so, how?
It's not possible to create a new statement, with suite and indentation rules without hacking the interpreter or resorting to alternative bytecode compilers such as "pyc". Creating a _function_ named "loop" is easy as Jonathan's answer shows. Georg -- http://mail.python.org/mailman/listinfo/python-list