Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.168 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.67; '*S*': 0.00; 'paths': 0.05; 'api': 0.09; '(0,': 0.09; 'themselves,': 0.09; 'andy': 0.16; 'determining': 0.16; 'iterating': 0.16; 'pairs': 0.16; 'range,': 0.16; 'wrote:': 0.17; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'topic': 0.27; 'chris': 0.28; 'skip:q 20': 0.29; 'read,': 0.29; 'probably': 0.29; 'this.': 0.29; 'that.': 0.30; 'usually': 0.30; 'query': 0.30; 'lists': 0.31; 'message.': 0.33; 'subject:List': 0.33; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'pm,': 0.35; 'something': 0.35; 'but': 0.36; "i'll": 0.36; 'subject: (': 0.36; 'skip:z 10': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'your': 0.60; 'range': 0.60; 'most': 0.61; 'email addr:gmail.com': 0.63; 'making': 0.64; 'stuck': 0.65; 'station': 0.66; 'header:Reply-To:1': 0.68; 'obvious': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'subject:this': 0.84; 'duration.': 0.84; 'works!': 0.84; 'stations': 0.91; 'subject:Best': 0.91; 'journey': 0.93 Date: Wed, 09 Jan 2013 18:49:53 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Best way to do this? List loop (matrix?) iteration References: <25c1f151-7323-42de-833f-15639b6eff71@googlegroups.com> <306bb7cd-c9b9-47db-87f5-a4aa8422a7c8@googlegroups.com> In-Reply-To: <306bb7cd-c9b9-47db-87f5-a4aa8422a7c8@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:AEvzzfAMkMx2GgFFztnGPkzlvFyQ+YmqK4/KpDOux3O FRfNPUfzCr5NTN8IANv6LYJAesnQHsTGD72NrHnMtU7ZguJbAw JGGRa/fNMW2fpC6j/cx+bE6D/j4odK+qbY+KncOA/GOeiWyZuh omBxFjeGTlAns9EPio3VBJjr4MAuCmxqT8RRgMUZS0JAP8kllr VqHhXUZQxeuKlmCivbccrpUrSbI0WlKIIOlNG/LTHzFGRMTk3j cbd8lx6agGFFJ/cnV+Z5LjBvCebE6fhtoyYXXWDA9C65ecDVcF gUdn1tzsTZBhBMYW+r20kkM7R/yDmTGppztdTyeYShvSru0ng= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357775430 news.xs4all.nl 6845 [2001:888:2000:d::a6]:50818 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36531 On 01/09/2013 06:24 PM, andydtaylor@gmail.com wrote: > Thanks for your help - this is what I did - though it's probably obvious to most people reading this. > > for rowcount in range (0, stn_count): > row_durations.append(stn_list_short[rowcount]) > for colcount in range (0, stn_count): > # 3. Determine Station pairs for API query > query_origin_stop = stn_list_long[rowcount] > query_destination_stop = stn_list_long[colcount] > # 4. Paths for determining duration. "station x = station x" has journey time 0 > # 4a. Stations are SAME > Please reread Chris Angelico's message. Iterating over the lists themselves, instead of making a range, is shorter, easier to read, and usually quicker. > ....etc. and this part works! I am now stuck on something else though, but I'll start a new topic for that. > > Thanks > > Andy Untested: for rowshort, query_origin_stop in zip(stn_list_short, stn_list_long): row_durations.append(rowshort) for query_destination_stop in stn_list_long: #4 . Determine ... -- DaveA