Re: generator slides review

2014-02-03 Thread Terry Reedy
On 2/3/2014 5:22 PM, andrea crotti wrote: That's already better, another thing which I just thought about could be this (which actually happened a few times): def original_gen(): count = 0 while count < 10: yield count count += 1 def consumer(): gen = original

Re: generator slides review

2014-02-03 Thread andrea crotti
2014-02-03 Terry Reedy : > On 2/2/2014 5:40 AM, andrea crotti wrote: >> > In general, use assert (== AssertionError) to check program logic (should > never raise). Remember that assert can be optimized away. Use other > exceptions to check user behavior. So I believe that ValueError is > appropriat

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread wxjmfauth
Le lundi 3 février 2014 19:55:26 UTC+1, Rotwang a écrit : > On 03/02/2014 18:37, wxjmfa...@gmail.com wrote: > > >> [...] > > >> > > >> Hint: try clicking the ¶. > > > > > > I never was aware of this "feature". Is it deliverate? > > > > Do you mean deliberate? Of course it is. > > > > >

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Rotwang
On 03/02/2014 18:37, wxjmfa...@gmail.com wrote: [...] Hint: try clicking the ¶. I never was aware of this "feature". Is it deliverate? Do you mean deliberate? Of course it is. It gives to me the feeling of a badly programmed html page, especially if this sign does correspond to an eol!

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Chris Angelico
On Tue, Feb 4, 2014 at 5:37 AM, wrote: > Le lundi 3 février 2014 18:42:36 UTC+1, Rotwang a écrit : >> On 03/02/2014 13:59, wxjmfa...@gmail.com wrote: >> Hint: try clicking the ¶. > > I never was aware of this "feature". Is it deliverate? > > It gives to me the feeling of a badly programmed > html

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread wxjmfauth
Le lundi 3 février 2014 18:42:36 UTC+1, Rotwang a écrit : > On 03/02/2014 13:59, wxjmfa...@gmail.com wrote: > > > [...] > > > > > > I noticed the same effect with the Python doc > > > since ? (long time). > > > > > > Eg. > > > > > > The Python Tutorial > > > appears as > > > The Python Tu

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread andrea crotti
2014-02-03 : > generator slides review and Python doc > > > I do not know what tool is used to produce such > slides. > > When the mouse is over a a text like a title ( ... <\H*> ???) > the text get transformed and a colored eol is appearing. > > Example with the slide #3: > > Even numbers > becom

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Rotwang
On 03/02/2014 13:59, wxjmfa...@gmail.com wrote: [...] I noticed the same effect with the Python doc since ? (long time). Eg. The Python Tutorial appears as The Python Tutorial¶ with a visible colored "¶", 'PILCROW SIGN', blueish in Python 3, red in Python 2.7.6. Hint: try clicking the ¶. --

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Michael Torrie
On 02/03/2014 06:59 AM, wxjmfa...@gmail.com wrote: > generator slides review and Python doc > > > I do not know what tool is used to produce such > slides. What slides? What web site are you referring to? A little context wouldn't hurt. -- https://mail.python.org/mailman/listinfo/python-list

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Jean-Michel Pichavant
- Original Message - > generator slides review and Python doc > > > I do not know what tool is used to produce such > slides. > > When the mouse is over a a text like a title ( ... <\H*> ???) > the text get transformed and a colored eol is appearing. Used to get a link to the given chap

Re: generator slides review

2014-02-02 Thread Terry Reedy
On 2/2/2014 5:40 AM, andrea crotti wrote: 2014-02-02 Terry Reedy : On 2/1/2014 9:12 AM, andrea crotti wrote: Comments: The use is assert in the first slide seem bad in a couple of different respects. Why is it bad? It's probably not necessary but since we ask for a range it might be good to

Re: generator slides review

2014-02-02 Thread andrea crotti
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

Re: generator slides review

2014-02-02 Thread Miki Tebeka
> Thank you that's nicer, but ifiilterfalse is not in Python 3 (could > > use filter of course). It was renamed to filterfalse - http://docs.python.org/3.3/library/itertools.html#itertools.filterfalse -- https://mail.python.org/mailman/listinfo/python-list

Re: generator slides review

2014-02-02 Thread Peter Otten
andrea crotti wrote: > 2014-02-01 Miki Tebeka : >> >> My 2 cents: >> slide 21: >> from itertools import count, ifilterfalse >> >> def divided_by(p): >> return lambda n: n % p == 0 >> >> def primes(): >> nums = count(2) >> while True: >> p = next(nums) >> yield p >>

Re: generator slides review

2014-02-02 Thread andrea crotti
Sorry left too early, the slides are updated with the fixes suggested, thanks everyone. https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#1 For me the biggest problem is still: - to find some more interesting example that is easy enough to explain - to find a better order in

Re: generator slides review

2014-02-02 Thread andrea crotti
The slides are updated now 2014-02-02 andrea crotti : > 2014-02-01 Miki Tebeka : >> >> My 2 cents: >> >> slide 4: >> [i*2 for i in range(10)] >> > > Well this is not correct in theory because the end should be the max > number, not the number of elements. > So it should be > [i*2 for i in range(10

Re: generator slides review

2014-02-02 Thread andrea crotti
2014-02-01 Miki Tebeka : > > My 2 cents: > > slide 4: > [i*2 for i in range(10)] > Well this is not correct in theory because the end should be the max number, not the number of elements. So it should be [i*2 for i in range(10/2)] which might be fine but it's not really more clear imho.. > slide

Re: generator slides review

2014-02-02 Thread andrea crotti
2014-02-02 Terry Reedy : > On 2/1/2014 9:12 AM, andrea crotti wrote: > > Comments: > > The use is assert in the first slide seem bad in a couple of different > respects. > Why is it bad? It's probably not necessary but since we ask for a range it might be good to check if the range is valid. Maybe

Re: generator slides review

2014-02-01 Thread Terry Reedy
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.c

Re: generator slides review

2014-02-01 Thread Miki Tebeka
On Saturday, February 1, 2014 6:12:28 AM UTC-8, 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 >