Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65246
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: generator slides review |
| Date | 2014-02-01 20:08 -0500 |
| References | <CAF_E5JYWZXkq98ri63BMQst3kpPVhO1K5xQbQ0ZHCuRTYZXvUA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6294.1391303316.18130.python-list@python.org> (permalink) |
On 2/1/2014 9:12 AM, andrea crotti wrote: > I'm giving a talk tomorrow @Fosdem about generators/iterators/iterables.. > > The slides are here (forgive the strange Chinese characters): > https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#3 > > and the code I'm using is: > https://github.com/AndreaCrotti/generators/blob/master/code/generators.py > and the tests: > https://github.com/AndreaCrotti/generators/blob/master/code/test_generators.py > > If anyone has any feedback or want to point out I'm saying something > stupid I'd love to hear it before tomorrow (or also later I might give > this talk again). Comments: The use is assert in the first slide seem bad in a couple of different respects. The use of 'gen_even' before it is defined. A generator expression evaluates (better than 'yields') to a generator, not just an iterator. The definition of 'generator' copies the wrong and confused glossary entry. Generator functions return generators, which are iterators with extra behavior. I would leave out For loop(2). The old pseudo-getitem iterator protocol is seldom explicitly used any more, in the say you showed. In 'Even numbers', I have no idea what the complication of next_even() is about. 'Lazyness drawbacks' overflow_list is bizarre and useless. overflow_gen is bizarre and buggy. If you are intentionally writing buggy code to make a point, label it as such on the slide. Iterators just produce values. Generators can consume as well as produce values, which is why they can act as both iterators and coroutines. @monocle -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: generator slides review Terry Reedy <tjreedy@udel.edu> - 2014-02-01 20:08 -0500
csiph-web