Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'example:': 0.03; 'subject:Python': 0.05; '"with"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'okay,': 0.16; 'printf': 0.16; 'received:209.85.213.174': 0.16; 'received:mail- yx0-f174.google.com': 0.16; 'wrote:': 0.18; 'simpler': 0.18; 'header:In-Reply-To:1': 0.22; 'message-id:@mail.gmail.com': 0.29; 'example': 0.29; 'pm,': 0.29; 'thu,': 0.32; 'list': 0.32; 'to:addr :python-list': 0.35; 'received:google.com': 0.37; "i'll": 0.38; 'received:209.85': 0.38; 'uses': 0.38; 'that.': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'show': 0.66; '"list': 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 :content-type; bh=dG7qMRGYtX26eQiLjt0QFGQ0V++K7/EFcAebR+5exsE=; b=wmChTOd880edacxJCfQKZkxEsnLMEwTUJSMexl4thfKLoxTJkC5TqOUIz8uqpzjVlN 6NNEDl0CeDxAUe6eXTGYx/2HMg015Xt1CMGgvEdBCY3I90icxsq/gUUHHz4JCzWfy1Ss 1zFWn67eCdLCI11d8DiUylp+tEbE0CmL/lTGhStKr8BvZGVqF4a0u9DIyQUjxq+riImm zayKg2U4M5evI9RniPG+NQbhM/eaD9Oz3eC9y9nv9gMVhZqAhsetkQibSYTQiATHGsRl mK36n1Gu/v5SCN28gRNse07n2yHk2hFoG2YG/Gy6vqDzdXUWzDm7vIswAzCe8A5rOijF v9zg== MIME-Version: 1.0 In-Reply-To: <4f61c828$0$1390$4fafbaef@reader2.news.tin.it> References: <4f612b19$0$1379$4fafbaef@reader2.news.tin.it> <8e72d74f-c844-4de3-8a37-f6b1fdc2291f@y27g2000yqy.googlegroups.com> <50e9ceec-40f1-4ead-b2b6-87328b30d084@ow8g2000pbc.googlegroups.com> <4f61c828$0$1390$4fafbaef@reader2.news.tin.it> Date: Thu, 15 Mar 2012 21:50:59 +1100 Subject: Re: Python is readable From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331808662 news.xs4all.nl 6960 [2001:888:2000:d::a6]:57767 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21652 On Thu, Mar 15, 2012 at 9:44 PM, Kiuhnm wrote: > Let's try that. > Show me an example of "list comprehensions" and "with" (whatever they are). I'll do a list comp, because they lend themselves well to one-liners. what_am_i = '\n'.join(["%X\t%c"%(i,i) for i in range(128)]) Okay, that one also uses printf formatting, which may be a smidge obscure. Here's a simpler example: what_am_i = [x*x for x in range(11)] ChrisA