[Python-iterators] RE: Meta: PEP discussion (was Re: PEP 255: Simple Generators)

Scott David Daniels Scott.Daniels at Acm.Org
Sat Jul 7 23:18:20 EDT 2001


"Gordon McMillan" <gmcm at hypernet.com> wrote in message
news:mailman.993160113.18969.python-list at python.org...
> Steven D. Majewski wrote:
>
> > My 'suspend value' actually got transformed into returning the
> > tuple
> >  (value, suspended-frame), so to use it in a loop required
> >  something
> > like:
> >
> >  iterf  = function  # don't mung up the global name
> >  while 1:
> >   value, iterf = iterf( args... )
> >   ... # first time, call the function
> >    # all others, call the suspended activation frame
How about the following (to make the loop control obvious):
  iterf  = function  # don't mung up the global name
  while iterf:
     value, iterf = iterf( args... )
     ... # first time, call the function
      # all others, call the suspended activation frame






More information about the Python-list mailing list