Path: csiph.com!usenet.pasdenom.info!news.albasani.net!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'welcome.': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; 'changes': 0.15; 'csv': 0.16; 'instead:': 0.16; 'subject:There': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'williams': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'run': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'version': 0.36; 'next': 0.36; 'method': 0.36; 'shows': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'pm,': 0.38; 'either': 0.39; 'skip:n 10': 0.64; '20,': 0.68; 'sender:addr:chris': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=go5S0KbS7vU3+I2dQbFReEkanAYBQl+UVu4wwVtqwt4=; b=Zzwn8+XLjJ8J+vleoaohb82soKnS5EccNp0rjQ46GODjYWTBT1Hgd0nAqvVdZJl/VZ 3d0Xm+75JTZAXorbgiYTfCbBHkqCBgq5Ewp04xLW0VOlwBDajwQYGhYWhlETki+Jzl5f keS9TAYeu9/zNEsCV7iBVmTR9V4YuuF7FGd1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=go5S0KbS7vU3+I2dQbFReEkanAYBQl+UVu4wwVtqwt4=; b=iqTeloUbqPkQRXGzzlqClpB00qcby+dx1hyK0MqK6A8Abp7IovSiV2c+KFP8PVm45g vdlV98bhgm7GZqPhQ4geTumbmsjKNfAJ86sl05RzwDtHCF3acr+Do0hWYs8BHOk/xmc1 Pv7wDNzESswedh+6gdn1uLggqIhnXIlXPv/rhe+QqK1OTo6QQ+OxWKnAEk7WdElvpPPY c7rBdO4ONleI4mNVJ0zpT2604yIdtvW+LgfOW/A9QAAjRbLR/29c0GPWcv2uwHK4tiMo 1vLtJ/bUCoGDG69jtRnEK05mHw0tBTySDEJXQQ2peyQJoeZkJF5sJ18r/AaEKqnRaer8 iDww== MIME-Version: 1.0 X-Received: by 10.50.164.162 with SMTP id yr2mr4900369igb.0.1366502225966; Sat, 20 Apr 2013 16:57:05 -0700 (PDT) Sender: chris@rebertia.com In-Reply-To: References: Date: Sat, 20 Apr 2013 16:57:05 -0700 X-Google-Sender-Auth: nItLyA9jPYuIttDlPPoglAkBMeM Subject: Re: There must be a better way From: Chris Rebert To: "Colin J. Williams" Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkOOPpNMIIHj5alVyV+okOk6Ks2fdSBuOv3bZ7YMtJ7czmN72cVXZETjOvDm/05jZ761HQD Cc: Python 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366502229 news.xs4all.nl 2204 [2001:888:2000:d::a6]:48604 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43974 On Sat, Apr 20, 2013 at 4:46 PM, Colin J. Williams wrote: > Below is part of a script which shows the changes made to permit the script > to run on either Python 2.7 or Python 3.2. > > I was surprised to see that the CSV next method is no longer available. > > Suggestions welcome. > if ver == '2': > headerLine= inData.next() > else: # Python version 3.3 > headerLine= inData.__next__() Use the built-in next() function (http://docs.python.org/2/library/functions.html#next ) instead: headerLine = next(iter(inData)) Cheers, Chris