Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ianhorn
on May 28, 2020
|
parent
|
context
|
favorite
| on:
The PEPs of Python 3.9
It'll always create a new object but my understanding is that at least in numpy the new and old object will share memory. Am I wrong there too?
aidos
on May 28, 2020
|
next
[–]
Correct. In Numpy the slices are views on the underlying memory. That’s why they’re so fast, there’s no copying involved. Incidentally that’s also why freeing up the original variable doesn’t release the memory (the slices are still using it).
dialamac
on May 28, 2020
|
prev
[–]
CPython is pretty terrible. Numpy has the concept of views, cpython doesn’t do anything sophisticated.
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: