Kent Johnson wrote: > wesley chun wrote: > >> below is a quick summary of the 2.5 highlights. of these, i like/use >> the following: >> 1, 2, 4, 5, 6, 7, (8), 9a, 9b. >> >> 7) Enhanced Generator Features (PEP 342) -- now you can "talk-back" to >> a generator, meaning you can send data into it as you resume it... >> .next() sends None, .send(obj) sends obj, .throw(exc) throws exception >> exc >> > > Are you using this? I would be interested in finding out how. \ In the past month I wrote a file parser that is sorta recursive descent. I wrote a generator that takes the first token of each file line and looks it up in the current keyword list. If not found it stops iteration, control returns to a higher level which has its own version of the generator instantiated with a different keyword list.
With the ability to pass an object, I can simplify my code so there is one instance of the generator, and each level passes its own keyword list. > This seems > like a feature that allows Python to be used in a new way, but I have > not yet seen any real applications of it. > > Kent > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Bob Gailer 510-978-4454 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor