Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65258

Re: generator slides review

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'elements.': 0.07; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'count,': 0.16; 'itertools': 0.16; 'lambda': 0.16; 'subject:generator': 0.16; 'true:': 0.16; 'import': 0.22; 'cc:addr:python.org': 0.22; 'fine': 0.24; 'cc:2**0': 0.24; 'header :In-Reply-To:1': 0.27; 'correct': 0.29; 'message- id:@mail.gmail.com': 0.30; 'updated': 0.34; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'yield': 0.36; 'thanks': 0.36; 'should': 0.36; 'clear': 0.37; 'thank': 0.38; 'filter': 0.38; 'changed': 0.39; 'number,': 0.60; 'break': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'andrea': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vh899T9vMm+xhlT4AVTQESvyHXJ3aJBzpjB3b3YT8Yw=; b=P9rF4XgatM0gfxLXrKc1653EuFQkWyLERrvgTksncXK63ALL8XCTtJKN5nJGWxnQ5+ N5qkWACUcvASUHpYKHnGBHuEk3MkV1rrEBipzK7jSXyOt+2GDDO830NjqPmkqFkJ6QeW BPqs0gYqoI5NxzdrNYtZw4zGcgwJmDkqF5dPXmX44jddwlM6JjY5pPtW0GvRAzswchPE 9G4N+zVf2Tw7Jmz8vVCaVXZhyBc2VWwdj2u/gKwjMTbjGQpwAotX6GMo87F+Iyd7NV2n fCNX3VrgX8h78PTdXTW/lZGRjyRg4Wylb1yoFzS++9gaj4rp58Ezmfzom9wety09O0yU xLSA==
MIME-Version 1.0
X-Received by 10.52.181.33 with SMTP id dt1mr20593768vdc.21.1391338244574; Sun, 02 Feb 2014 02:50:44 -0800 (PST)
In-Reply-To <CAF_E5JYd1boDw82a+ScAg9WR5z-Zwj_Qc3OWDfNtKXeVV+vRCw@mail.gmail.com>
References <mailman.6278.1391263956.18130.python-list@python.org> <8118b17c-3352-4832-8567-089bd14c21ce@googlegroups.com> <CAF_E5JYd1boDw82a+ScAg9WR5z-Zwj_Qc3OWDfNtKXeVV+vRCw@mail.gmail.com>
Date Sun, 2 Feb 2014 10:50:44 +0000
Subject Re: generator slides review
From andrea crotti <andrea.crotti.0@gmail.com>
To Miki Tebeka <miki.tebeka@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6303.1391338252.18130.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391338252 news.xs4all.nl 2886 [2001:888:2000:d::a6]:57962
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65258

Show key headers only | View raw


The slides are updated now

2014-02-02 andrea crotti <andrea.crotti.0@gmail.com>:
> 2014-02-01 Miki Tebeka <miki.tebeka@gmail.com>:
>>
>> 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 9:
>> while True:
>>     try:
>>         it = next(g)
>>         body(it)
>>     except StopIteration:
>>         break
>>
>
> Changed it thanks
>
>> 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
>>         nums = ifilterfalse(divided_by(p), nums)
>>
>
> Thank you that's nicer, but ifiilterfalse is not in Python 3 (could
> use filter of course).

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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