Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92153
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Nobody <nobody@nowhere.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: So what's happening here? |
| Date | Fri, 05 Jun 2015 15:13:56 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <pan.2015.06.05.14.16.06.63000@nowhere.invalid> (permalink) |
| References | <pan.2015.06.05.12.46.21@nowhere.invalid> <mailman.196.1433508938.13271.python-list@python.org> <pan.2015.06.05.13.11.13@nowhere.invalid> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx02.eternal-september.org; posting-host="152d4dee6f95183c956ee6fa63d7e69f"; logging-data="11320"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FKOVZPwyHoTFYaW1TLRoJ" |
| User-Agent | Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
| Cancel-Lock | sha1:6zHngrZyZ5ezU6mqtdiOma5pDNs= |
| Xref | csiph.com comp.lang.python:92153 |
Show key headers only | View raw
On Fri, 05 Jun 2015 13:11:13 +0000, Paul Appleby wrote: > (I'd have thought that id(a[1]) and id(b[1]) would be the same if they > were the same element via different "views", but the id's seem to change > according to rules that I can't fathom.) First, a[1] and b[1] aren't views, they're scalars. Second, different views on the same data are different objects, they just share the same underlying data. Consider the case where the slice doesn't cover the entire range: > a = np.array([1,2,3]) > b = a[:2] > a array([1, 2, 3]) > b array([1, 2]) > id(a) 139682716078288 > id(b) 139682716078368 > b[0] = 99 > a array([99, 2, 3]) > b array([99, 2]) The case where a slice *does* cover the entire range isn't special; the resulting view is still a different object.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
So what's happening here? Paul Appleby <pap@nowhere.invalid> - 2015-06-05 12:46 +0000
Re: So what's happening here? Fabien <fabien.maussion@gmail.com> - 2015-06-05 14:52 +0200
Re: So what's happening here? Larry Martell <larry.martell@gmail.com> - 2015-06-05 08:55 -0400
Re: So what's happening here? Peter Otten <__peter__@web.de> - 2015-06-05 15:09 +0200
Re: So what's happening here? Paul Appleby <pap@nowhere.invalid> - 2015-06-05 13:11 +0000
Re: So what's happening here? Gary Herron <gary.herron@islandtraining.com> - 2015-06-05 06:23 -0700
Re: So what's happening here? Steven D'Aprano <steve@pearwood.info> - 2015-06-05 23:51 +1000
Re: So what's happening here? Nobody <nobody@nowhere.invalid> - 2015-06-05 15:13 +0100
csiph-web