Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65246 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2014-02-01 20:08 -0500 |
| Last post | 2014-02-01 20:08 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: generator slides review Terry Reedy <tjreedy@udel.edu> - 2014-02-01 20:08 -0500
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-02-01 20:08 -0500 |
| Subject | Re: generator slides review |
| Message-ID | <mailman.6294.1391303316.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web