Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: justin walters Newsgroups: comp.lang.python Subject: Re: Pythonic love Date: Tue, 8 Mar 2016 09:17:06 -0800 Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de a3oIqhauMUKJbCt+mlcNfAOm8r6osUcL9+lMVm+p2+SA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'expressions': 0.07; 'generators': 0.09; 'posting.': 0.09; 'wrong,': 0.09; 'python': 0.10; 'def': 0.13; 'received:74.125.82.44': 0.15; '2016': 0.16; 'iterable)': 0.16; 'iterable:': 0.16; 'justin': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'then?': 0.16; 'wrote:on': 0.16; 'wrote:': 0.16; 'do.': 0.22; 'function:': 0.22; 'cheers,': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'yield': 0.27; 'correct': 0.28; "i'm": 0.30; 'url:mailman': 0.30; 'probably': 0.31; 'statement': 0.32; 'url:python': 0.33; 'usually': 0.33; 'url:listinfo': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'functions.': 0.35; 'lists.': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'cases': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'version': 0.38; 'thank': 0.38; 'mailing': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'hello,': 0.40; 'address': 0.61; 'different': 0.63; 'mar': 0.65; 'email name:python-list': 0.67; 'reply': 0.68; 'walters': 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; bh=moH+TYU2xys72RL8QBgNTxfNK79Sw0TBLoQ7ysC+CtE=; b=GHlnpAGXkk70uDr6vC+7WwuUllaCt6ltju4gQHfDEaOMn0ClUiKvX11HgSdQtybnjC 6Z724ntxkWp6UyyQYMGhxtCe1eVY00/NkT9fH/Cs+rQulhA1gTQ4+lKHMuysn3ZzZAQj bgfa5HjzbWevHh6wq2ezga/AAsrA7hig9nhJMq5RvM9ONC0dgCdrf7ZL6N6qiYwVVxkl a3zx2GIQumho1i6KIekDQXn3cZlyI4fGA3DLPpIgkKpT6o03K0P0FGykbFwXiNljr0i4 4+kD6qEZ6pEZp1G5xPBhz5F+J74/67VUSM9M9gxWC0HUmLqQsJRv5OGxKCBEwlAeG8z0 IvBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=moH+TYU2xys72RL8QBgNTxfNK79Sw0TBLoQ7ysC+CtE=; b=XQAw3kfuyh0y9fiTcDYvX1JZZERFRxlsEcpOeBlp31hN7fRjP6ixFDkdEYzUyhgCR8 5SrMmTiPbhD0ONpR3KlDfpHe4A4NOpc/qBLMHOqOsSHujAW2vjUgTtFC0CzrABLXFiHA rajb0pSAJc7iKesqbWidmX0kjCH7HWwcPO4BYWbCBojjbtwCipi0V3CrOXr/51TtlHzX N6jPbCVFQIkVZVZPrtLsF1SKut2o8FuJBIcqk+6euFsIrPoXxLUPTPQXcZP3eYfrTK+F otWdoJ1Jr6M6C6l/xDi96M55F4fE6RP1zlULHemQkGsWQvSQqcgRBFEzlKHBQiYIHxqu BCdQ== X-Gm-Message-State: AD7BkJIS9gJlDjsXx4dj7LYaA7YDvRfnSErL1LPIA6P03irqXJlEWBYJgNJDyd/s4nHmlZTeUagcigZ9+4UrwA== X-Received: by 10.28.128.83 with SMTP id b80mr16829964wmd.6.1457457426727; Tue, 08 Mar 2016 09:17:06 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104348 Sorry about the top posting. I'm new to mailing lists. I should just reply to the python-list@python.org address then? Also, thank you for the generator clarification. On Mar 8, 2016 9:09 AM, "jmp" wrote: > On 03/08/2016 05:49 PM, justin walters wrote: > >> Correct me if I'm wrong, but don't python generators usually use the yield >> statement so they can be used in list comprehensions? >> > > Hello, > > Please don't top post. > > Generator expressions are different from generator functions. They are > both generators but use a different syntax. > > generator function: > > def func(iterable): > for i in iterable: yield i > > > the generator expression version would be > > (i for i in iterable) > > > Both have their use cases but everytime you can actually use an generator > expression, it's probably the correct thing to do. > > Cheers, > > jm > > -- > https://mail.python.org/mailman/listinfo/python-list >