Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41378
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <bahamutzero8825@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'subject:Python': 0.05; '(python': 0.05; 'cpython': 0.05; 'subject:two': 0.07; '"in"': 0.16; 'example?': 0.16; 'iterates': 0.16; 'sorted()': 0.16; 'subject:2.7.3': 0.16; 'subject:between': 0.16; 'subject:these': 0.16; 'variable.': 0.16; 'wrote:': 0.17; 'example.': 0.17; 'variables': 0.17; 'url:view': 0.18; 'subject:] ': 0.19; 'windows': 0.19; 'question.': 0.20; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'run': 0.28; 'objects': 0.29; 'points': 0.29; 'point': 0.31; 'to:addr:python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:192.168.0': 0.35; 'list.': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'url:org': 0.36; 'does': 0.37; 'two': 0.37; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'list,': 0.39; 'received:192.168': 0.40; 'first': 0.61; 'between': 0.63; 'here': 0.65; '9.1': 0.84; 'returns.': 0.84; 'tricky': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=am5HGIDzbJ4Auti0utBGpwvOk+iAe0i9WMpqzz3D19s=; b=kglUOk0HKFIB9QF6Kmx6o80rghi8Gl0lLM/+fDd2eENs4G6yvnnT+XoQVAb+MFWDQY LIcsC+eDYcUMOVCbS9Igpn65NBP6DNkrHGhvFSCurNayxKxQgIv8y7jGegBs2H2nLiPX VAINyw/onG4lwNuwCbdjQJkoyPI3SbH/9m1JNAcOaK2PVuxKXQueUgfWM0PFL7jYjz6L teLcI2eDxLCZC+vJcu2oRpJcZebpP0xLiAMrNu7NzeIh61ZfxDlLwMs5JLquRunf/3Jq 1LAZdOMqn2HL6bUMxK4rbv9Hlq0Mlr87W+L059QRVlua7CVsr/zVzMT4YXZ71tLgJwq4 UwuA== |
| X-Received | by 10.50.47.200 with SMTP id f8mr27628790ign.98.1363569872753; Sun, 17 Mar 2013 18:24:32 -0700 (PDT) |
| Date | Sun, 17 Mar 2013 20:24:30 -0500 |
| From | Andrew Berg <bahamutzero8825@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | "comp.lang.python" <python-list@python.org> |
| Subject | Re: [Python 2.7.3] What's the difference between these two uses of "for"? |
| References | <485a3093-8c07-4d1a-b49e-af32f84f8198@googlegroups.com> |
| In-Reply-To | <485a3093-8c07-4d1a-b49e-af32f84f8198@googlegroups.com> |
| X-Enigmail-Version | 1.5.1 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3402.1363569881.2939.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1363569881 news.xs4all.nl 6949 [2001:888:2000:d::a6]:56090 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41378 |
Show key headers only | View raw
On 2013.03.17 19:58, Yves S. Garret wrote: > N00b question. But here is the code: > > http://bin.cakephp.org/view/709201806 > > In the first example, the first for-loop is run and then the list is assigned to the tricky variable. But, what > happens in the second example? Does the loop after "in" get run only once or multiple number of times? > In the first example, sorted() returns a list, which is assigned to the name tricky (Python doesn't have variables - names simply point to objects in memory), and then the for loop iterates over tricky, which points to a list. In the second example, the for loop iterates over the list that sorted() returns. The only difference between the two is that the list that sorted() returns is assigned to a name in the first example. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 17:58 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Andrew Berg <bahamutzero8825@gmail.com> - 2013-03-17 20:24 -0500
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Gary Herron <gary.herron@islandtraining.com> - 2013-03-17 18:18 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 18:59 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 18:59 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 19:14 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Dave Angel <davea@davea.name> - 2013-03-18 07:38 -0400
Re: [Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 19:14 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Roy Smith <roy@panix.com> - 2013-03-17 22:33 -0400
Re: What's the difference between these two uses of "for"? alex23 <wuwei23@gmail.com> - 2013-03-18 18:08 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-18 02:44 +0000
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Roy Smith <roy@panix.com> - 2013-03-17 22:51 -0400
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Roy Smith <roy@panix.com> - 2013-03-17 21:28 -0400
Re: [Python 2.7.3] What's the difference between these two uses of "for"? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-17 19:01 -0700
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Roy Smith <roy@panix.com> - 2013-03-17 22:28 -0400
Re: [Python 2.7.3] What's the difference between these two uses of "for"? Terry Reedy <tjreedy@udel.edu> - 2013-03-18 00:37 -0400
csiph-web