Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65290
| References | <mailman.6278.1391263956.18130.python-list@python.org> <8118b17c-3352-4832-8567-089bd14c21ce@googlegroups.com> <mailman.6302.1391338128.18130.python-list@python.org> <ed96e4f0-5a72-48de-a00c-8f4a19ce0756@googlegroups.com> |
|---|---|
| Date | 2014-02-02 22:55 +0000 |
| Subject | Re: generator slides review |
| From | andrea crotti <andrea.crotti.0@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6311.1391381767.18130.python-list@python.org> (permalink) |
Thanks everyone for your feedback.
The talk I think went well, maybe I was too fast because I only used 21 minutes.
>From the audience feedback, there were some questions about my "Buggy
code" example, so yes probably it's not a good example since it's too
artificial.
I'll have to find something more useful about that or just skip this maybe.
For possible generators drawbacks though I could add maintanability,
if you start passing generators around in 3-4 nested levels finding
out what is the original source of can be difficult.
I'm also still not convinced by the definitions, which I tried now to
make clear and ay something like:
- and iterator defines *how you iterate* over an object (with the
__next__ method)
- an iterable defines *if you can iterate* over an object (with the
__iter__ method)
And when I do something like this:
class GenIterable:
def __init__(self, start=0):
self.even = start if is_even(start) else start + 1
def __iter__(self):
return self
def __next__(self):
tmp = self.even
self.even += 2
return tmp
it basically means that the a GenIterable object is iterable (because
of __iter__) and the way you iterate over it is to call the next
method on the object itself (since we return self and we define
__next__).
That seems clear enough, what do you think?
I might give this talk again so feedback is still appreciated!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
generator slides review andrea crotti <andrea.crotti.0@gmail.com> - 2014-02-01 14:12 +0000
Re: generator slides review Miki Tebeka <miki.tebeka@gmail.com> - 2014-02-01 08:50 -0800
Re: generator slides review andrea crotti <andrea.crotti.0@gmail.com> - 2014-02-02 10:48 +0000
Re: generator slides review Miki Tebeka <miki.tebeka@gmail.com> - 2014-02-02 06:59 -0800
Re: generator slides review andrea crotti <andrea.crotti.0@gmail.com> - 2014-02-02 22:55 +0000
Re: generator slides review andrea crotti <andrea.crotti.0@gmail.com> - 2014-02-02 10:50 +0000
Re: generator slides review andrea crotti <andrea.crotti.0@gmail.com> - 2014-02-02 10:52 +0000
Re: generator slides review Peter Otten <__peter__@web.de> - 2014-02-02 13:47 +0100
csiph-web