Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.151 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.73; '*S*': 0.04; 'subject:create': 0.09; 'brackets:': 0.16; 'goebel': 0.16; 'patience': 0.16; 'shorthand': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'didnt': 0.31; 'subject:lists': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thank': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'expression': 0.60; 'thomas': 0.65; 'miss': 0.74; 'square': 0.74; 'as:': 0.81; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=DtYxsZ/0+SZKUNHL0JjBIRE9dai6N2nd8CHa1aRqXgM=; b=TonEDk5gyz+IB+Jpquk++Ab+QJrDRWfn8AXcEeFcavILkYoVzFFLiFGxV2roln9gtX 7FV8KXUkpsaYpmS/IQAjOEy2x7tA4hh9nxDfM0Fd2bl58Uxzf1qS5Oe/J1Iwu9UujO+0 n/t0xxQoJ2fYnJCLoF5Qm8MnrKmBvEbAwieAkmiSohG2F8DcQM1SY3+CvFl8Ep/QfbSG L8HIxuSYVtlJyohAqrAD6zJxsG5ui6Ce6K+8SyLS9pEuA2po58KTKi+2aEuLzA2YraRU HP3sCw8bFMXnwexV3s8+3C5LxrpxKvwByit+dlMmb68z8eBJ+mY6AvL1z+8iGcTZ8oSE v5kA== MIME-Version: 1.0 X-Received: by 10.182.116.70 with SMTP id ju6mr2294681obb.48.1365689473891; Thu, 11 Apr 2013 07:11:13 -0700 (PDT) In-Reply-To: <5166B345.8080200@th-nuernberg.de> References: <4c47da9e-c632-4855-98a7-0506d8013046@googlegroups.com> <51656F6A.5040103@th-nuernberg.de> <5166A297.70104@th-nuernberg.de> <5166B345.8080200@th-nuernberg.de> Date: Thu, 11 Apr 2013 16:11:13 +0200 Subject: Re: use a loop to create lists From: Franz Kelnreiter To: python-list@python.org Content-Type: multipart/alternative; boundary=f46d042de925f704ae04da165b80 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365689481 news.xs4all.nl 2564 [2001:888:2000:d::a6]:37376 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43372 --f46d042de925f704ae04da165b80 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Apr 11, 2013 at 2:57 PM, Thomas Goebel < Thomas.Goebel@ohm-hochschule.de> wrote: > ... > Which is the same as: > f = {'list_' + str(n):[m for m in range(3)] for n in range(3)} > Thomas, thank you for your patience and your long explanation! Now I understand better this shorthand expression of one single 'pythonic' ;) line. But didnt you miss square brackets: f = {'list_' + str(n):[[m for m in range(3)] for n in range(3)]} ?? Otherwise the code wont work for me... --f46d042de925f704ae04da165b80 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Apr 11, 2013 at 2:57 PM, Thomas Goebel <Thomas.Goebel@ohm-hochschule.de> wrote:
...
Which is the same as:
f =3D {'list_' + str(n):[m for m in range(3)] for n in range(3)}

Thomas, thank you for your patience= and your long explanation! Now I understand better this shorthand expressi= on of one single 'pythonic' ;) line.
But didnt you miss square brackets:

f =3D = {'list_' + str(n):[[m for m in range(3)] for n in range(3)]}= =A0

??
Otherwise the code wont = work for me...

--f46d042de925f704ae04da165b80--