Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'oct': 0.02; 'way:': 0.05; 'unexpected': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '25,': 0.12; 'bieber': 0.16; 'declaimed': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'situations,': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'url:home': 0.21; 'tue,': 0.23; 'alan': 0.23; 'slice': 0.23; 'pm,': 0.24; 'lee': 0.28; 'second': 0.29; 'kelly': 0.30; "who'd": 0.30; 'subject:?': 0.31; 'list': 0.32; 'generally': 0.32; 'usually': 0.32; 'to:addr :python-list': 0.33; 'copying': 0.33; 'header:X-Complaints-To:1': 0.35; 'rather': 0.35; 'subject:How': 0.35; 'another': 0.37; 'passed': 0.37; 'list,': 0.37; 'something': 0.37; 'received:org': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; '"what': 0.67; 'dennis': 0.77; 'meyer': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: How to isolate a constant? Date: Tue, 25 Oct 2011 17:08:24 -0700 Organization: > Bestiaria Support Staff < References: <4EA71323.2030500@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: user-11fb5l5.dsl.mindspring.com X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1319587711 news.xs4all.nl 6980 [2001:888:2000:d::a6]:54324 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:14988 On Tue, 25 Oct 2011 14:05:49 -0600, Ian Kelly declaimed the following in gmane.comp.python.general: > On Tue, Oct 25, 2011 at 1:50 PM, Alan Meyer wrote: > >> Python will copy something only when you tell it to copy. A simple way > >> of copying a list is to slice it: > >> > >> someList = self._someList[:] > > > > And another simple way: > > > >    ... > >    someList = list(self._someList) > >    ... > > I generally prefer the latter. It's clearer, and it guarantees that > the result will be a list, which is usually what you want in these > situations, rather than whatever unexpected type was passed in. > Where's the line form to split those who'd prefer the first vs the second result in this sample : >>> unExpected = "What about a string" >>> firstToLast = unExpected[:] >>> repr(firstToLast) "'What about a string'" >>> explicitList = list(unExpected) >>> repr(explicitList) "['W', 'h', 'a', 't', ' ', 'a', 'b', 'o', 'u', 't', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g']" >>> -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/