Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'definitions': 0.07; 'latter': 0.09; 'cc:addr:python-list': 0.11; '"""\\': 0.16; '"d"': 0.16; 'readable': 0.16; 'statement.': 0.16; 'to:addr:web.de': 0.16; 'sender:addr:gmail.com': 0.17; 'thanks,': 0.17; 'wrote:': 0.18; 'meant': 0.20; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; 'strip': 0.31; 'lists': 0.32; 'agree': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; "didn't": 0.36; 'example,': 0.37; 'list': 0.37; 'problems': 0.38; 'rather': 0.38; 'skip:. 10': 0.39; 'august': 0.61; 'first': 0.61; 'save': 0.62; 'more': 0.64; 'taking': 0.65; 'otten': 0.84; 'developments': 0.95; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Z4mttdJulHGfJ2a8QcFpcx1Zt1c+XVym7X708aaykXk=; b=LB9V8lXk9kK0ZW9VA6lUzV/no+hnkTe2XvHGE7Njwi6hYVam4OLBBUf6PlctYnoBRk ddLXfn2+VunIHpQ9tQMeIPW0YdK9Emr+gLzY+64+sBEiEVaYDhxV4jND7qD0VXOJYbkc uOEqqgiQ4V6pDF2CG3Djo/yvOJt75NUu/SoK0dkaEC7kYAOTr9U1KvxTXtpIdvxAHE2q BJdcZ4nOTOlkER1avp8r6oAFp7DMViisycHvqceQgKQxQrgvVmbDDGlWljFxn7YAwdzA COplLLTgK9idJW8KnAg82E5FRa1AXSSya+inq1avpRb/Kj9c28j2mjr6hxa+hh9A3Xak urKg== X-Received: by 10.152.19.70 with SMTP id c6mr8412282lae.25.1376481363663; Wed, 14 Aug 2013 04:56:03 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: References: <94f8428f-50b9-4ccd-95a0-6eeafda0fe18@googlegroups.com> From: Joshua Landau Date: Wed, 14 Aug 2013 12:55:23 +0100 X-Google-Sender-Auth: 5C3P-Rr-R3FuxQn38lhgWwimG7U Subject: Re: .split() Qeustion To: Peter Otten <__peter__@web.de> Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376481372 news.xs4all.nl 15953 [2001:888:2000:d::a6]:53653 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52508 On 14 August 2013 12:45, Peter Otten <__peter__@web.de> wrote: > Joshua Landau wrote: >> On 14 August 2013 09:30, Alister wrote: >>> I would agree with the last statement. >>> Please write list definitions as lists rather than taking a short-cut to >>> save a few key presses >> >> That's true with this example, but is: >> >> lines = [ >> "Developments in high-speed rail, and high-speed", > ... >> "same problems the latter was designed to solve." >> ] >> >> really more readable than: >> >> lines = """\ >> Developments in high-speed rail, and high-speed > ... >> same problems the latter was designed to solve. >> """[1:-1].split("\n") >> >> ? > > It's definitely more correct -- unless you meant to strip the "D" from the > first line ;) > > I would use > > lines = """\ > Developments in high-speed rail, and high-speed > ... > same problems the latter was designed to solve. > """.splitlines() Thanks, I didn't actually know about .splitlines()!