Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26862
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| 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; 'python,': 0.02; 'subject:: [': 0.03; 'output': 0.04; 'cpython': 0.05; 'objects,': 0.07; 'subject:question': 0.08; '(1,': 0.09; 'behave': 0.09; 'explanation': 0.09; 'mutable': 0.09; 'objects.': 0.09; 'tuple': 0.09; 'way:': 0.09; 'cc:addr:python-list': 0.10; 'aug': 0.13; 'constants': 0.16; 'ids.': 0.16; 'nonetheless': 0.16; 'one- element': 0.16; 'parameters,': 0.16; 'time).': 0.16; 'string': 0.17; 'wrote:': 0.17; 'subject:] ': 0.19; 'parameters': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'compiled': 0.27; "doesn't": 0.28; 'chris': 0.28; '>>>>': 0.29; 'fri,': 0.30; 'lists': 0.31; 'subject:lists': 0.32; 'right?': 0.33; 'thanks': 0.34; 'pm,': 0.35; 'but': 0.36; 'possible': 0.37; 'two': 0.37; 'things': 0.38; 'nothing': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'course.': 0.62; 'different': 0.63; 'more': 0.63; 'header:Reply- To:1': 0.68; 'believe': 0.69; 'received:74.208': 0.71; 'reply- to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84; 'dealt': 0.91; 'angel': 0.93 |
| Date | Fri, 10 Aug 2012 06:56:12 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | Chris Angelico <rosuav@gmail.com> |
| Subject | Re: [newbie] A question about lists and strings |
| References | <k02jn0$id2$1@news.albasani.net> <39A401F0-12DD-464F-A0D1-639C56FA48A0@gmail.com> <mailman.3148.1344592099.4697.python-list@python.org> <k02mpk$p0e$1@news.albasani.net> <CAPTjJmrabsW3w8WNqDNeGU8f5rc0Kq0U83Vd7To7sX-SOWWtew@mail.gmail.com> |
| In-Reply-To | <CAPTjJmrabsW3w8WNqDNeGU8f5rc0Kq0U83Vd7To7sX-SOWWtew@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:NNGNq7KSit1mXAk4IDLxIcwNNmdVrT8d54rQmKl7Plt wfSxTlWz2ZgSBJ4P3VdV9sNhvBvux6yb9C7xs6ktxBMSOF+KJW GZQ3z/cUwiUwCe1r+J6PZvVqRGYdv4zVhSwALnCAlnU8h8VK23 1Xj4K8nZlKH3pN5/uoXl1ZLU3tDZW7TIWhVVUzOTKxjd3j1bIW K1s0oXr2uO36C9LvT6mqSreOv64RtWqqHwUfjZnrxnjNcLXoCu aIYDls55fLAcbatrf2EyOnQDd4nEnalAx7YlRoTUBVdKe3FoTr qoOmZEw2TO0r2gPeGRqF0BFwI/gPWyUK7aaBVoATuMCVHwx9w= = |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | d@davea.name |
| 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.3156.1344596195.4697.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1344596195 news.xs4all.nl 6879 [2001:888:2000:d::a6]:42963 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26862 |
Show key headers only | View raw
On 08/10/2012 06:37 AM, Chris Angelico wrote: > On Fri, Aug 10, 2012 at 8:12 PM, Mok-Kong Shen > <mok-kong.shen@t-online.de> wrote: >> Thanks for the explanation of the output obtained. But this means >> nonetheless that parameters of types lists and strings are dealt with >> in "inherently" (semantically) different ways by Python, right? > It's nothing to do with parameters, but yes, lists are mutable and > strings are immutable. A tuple will behave the same way a string does: > >>>> a > (1, 2, 3, 4) >>>> b=a >>>> a+=5, # note that "5," is a one-element tuple >>>> a > (1, 2, 3, 4, 5) >>>> b > (1, 2, 3, 4) > > > By the way: > > On Fri, Aug 10, 2012 at 8:07 PM, Dave Angel <d@davea.name> wrote: >> But if you said c=651 and d=651, you'd have two >> objects, and the two names would be bound to different objects, with >> different ids. > To be more accurate, you *may* have two different objects. It's > possible for things to be optimized (eg with small numbers, or with > constants compiled at the same time). > > ChrisA You're right, of course. But I picked the value of 650+ deliberately, as I believe CPython doesn't currently optimize ints over 256. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 11:19 +0200
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 13:28 +0400
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 13:48 +0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:12 +0200
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 20:37 +1000
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:37 -0400
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 14:56 +0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 13:08 +0200
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:56 -0400
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 21:00 +1000
Re: [newbie] A question about lists and strings Roman Vashkevich <vashkevichrb@gmail.com> - 2012-08-10 15:06 +0400
Re: [newbie] A question about lists and strings Peter Otten <__peter__@web.de> - 2012-08-10 11:59 +0200
Re: [newbie] A question about lists and strings Rotwang <sg552@hotmail.co.uk> - 2012-08-10 16:12 +0100
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:07 -0400
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:31 +0200
Re: [newbie] A question about lists and strings Chris Angelico <rosuav@gmail.com> - 2012-08-10 20:40 +1000
Re: [newbie] A question about lists and strings Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-08-10 12:48 +0200
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:58 -0400
Re: [newbie] A question about lists and strings Dave Angel <d@davea.name> - 2012-08-10 06:53 -0400
csiph-web