Created
May 1, 2017 05:52
-
-
Save njsmith/0ffd38ec05ad8e34004f34a7dc492227 to your computer and use it in GitHub Desktop.
pypy3's memoryview is very clever
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>>> b = bytearray(10) | |
>>>> m = memoryview(b) | |
>>>> m._pypy_raw_address() | |
140164544488368 | |
>>>> b += bytes(100) | |
>>>> m._pypy_raw_address() | |
140164544178608 | |
>>>> b[0] = 1 | |
>>>> m[0] | |
1 | |
>>>> m[0] = 2 | |
>>>> b[0] | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment