Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65393
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'duplicate': 0.07; '[1,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'references.': 0.09; 'subtle': 0.09; 'python': 0.11; 'random': 0.14; '>that': 0.16; '>to': 0.16; 'bytes;': 0.16; 'descending': 0.16; 'did,': 0.16; 'interesting:': 0.16; 'message-id:@4ax.com': 0.16; 'overwriting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'referencing': 0.16; 'later': 0.20; 'feb': 0.22; '>>>': 0.22; 'memory': 0.22; 'import': 0.22; 'print': 0.22; 'byte': 0.24; 'bytes': 0.24; 'url:home': 0.24; 'earlier': 0.24; 'initial': 0.24; 'mon,': 0.24; 'order.': 0.26; 'references': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'appear': 0.29; 'array': 0.29; '-0700,': 0.31; 'continues': 0.31; 'them?': 0.31; 'values.': 0.31; 'addresses': 0.33; 'bugs': 0.33; 'subject:the': 0.34; 'objects': 0.35; 'doubt': 0.36; 'charset:us-ascii': 0.36; 'to:addr:python-list': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'ian': 0.60; 'first': 0.61; 'address': 0.63; 'pick': 0.64; 'different': 0.65; 'production': 0.68; 'intern': 0.84; 'received:108': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: __init__ is the initialiser |
| Date | Mon, 03 Feb 2014 19:38:33 -0500 |
| Organization | IISS Elusive Unicorn |
| References | <lchce7$44q$1@ger.gmane.org> <52EC3C40.7080402@stoneleaf.us> <mailman.6251.1391224639.18130.python-list@python.org> <52ec84bc$0$29972$c3e8da3$5496439d@news.astraweb.com> <roy-5740C1.00250401022014@news.panix.com> <bl81skFh14iU1@mid.individual.net> <mailman.6313.1391383680.18130.python-list@python.org> <roy-C454F0.18405902022014@news.panix.com> <d37ve99ne6g7m3ijpi4f3mudea3r8t7cu4@4ax.com> <CALwzidmQUqKxFNXpY84jH_-SKmScQqBKqr9PRn4nGFWcBCdM2w@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-108-79-220-239.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 6.00/32.1186 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6373.1391474302.18130.python-list@python.org> (permalink) |
| Lines | 54 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1391474302 news.xs4all.nl 2871 [2001:888:2000:d::a6]:45053 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:65393 |
Show key headers only | View raw
On Mon, 3 Feb 2014 10:44:21 -0700, Ian Kelly <ian.g.kelly@gmail.com>
declaimed the following:
>
>If Python interns the byte objects though, won't overwriting them lead
>to subtle bugs later on as Python attempts to reuse them? They may
>even be reused already from earlier byte objects with the same values,
>that may or may not still have references.
I suspect Python won't intern the /array/ of bytes; just the references
to the individual values -- and overwriting will change the references to
different interned values. I doubt the interning of the individual values
will appear in the order of the initial key -- and even if they did, any
duplicate bytes in the initial key would start by referencing the first
occurrence, while the randomization process would pick other interned
location.
>>> import array
>>> key = array.array("i", [1, 2, 3, 1, 3, 4])
>>> key
array('i', [1, 2, 3, 1, 3, 4])
>>> for i in key:
... print id(i)
...
3029624
3029600
3029576
3029624
3029576
3029552
>>> for i in range(len(key)):
... key[i] = key[i] * 3 - 2 #imagine this is a random production
...
>>> for i in key:
... print id(i)
...
3029624
3029552
3029480
3029624
3029480
3029408
>>> key
array('i', [1, 4, 7, 1, 7, 10])
>>>
Interesting: the IDs for 1, 2, 3, 4 -- if memory addresses -- are in
descending address order. And that continues through the replacement
values.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: __init__ is the initialiser Terry Reedy <tjreedy@udel.edu> - 2014-01-31 22:16 -0500
Re: __init__ is the initialiser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-01 05:23 +0000
Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-01 00:25 -0500
Re: __init__ is the initialiser Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-03 12:15 +1300
Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 10:27 +1100
Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 18:40 -0500
Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 11:07 +1100
Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:24 -0800
Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 12:37 +1100
Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:54 -0800
Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 08:44 -0500
Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 13:50 +0000
Re: __init__ is the initialiser Ian Kelly <ian.g.kelly@gmail.com> - 2014-02-03 10:44 -0700
Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-04 04:57 +1100
Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 19:57 +0000
Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 19:38 -0500
Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 19:35 -0500
Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 19:45 -0500
Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 22:14 -0500
Re: __init__ is the initialiser Skip Montanaro <skip@pobox.com> - 2014-02-02 21:15 -0600
Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-03 00:06 -0500
Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-03 00:12 -0500
Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 16:49 +1100
Re: __init__ is the initialiser Ethan Furman <ethan@stoneleaf.us> - 2014-02-02 21:34 -0800
Re: __init__ is the initialiser Rustom Mody <rustompmody@gmail.com> - 2014-01-31 21:31 -0800
csiph-web