Message139883
> I thought the rationale for the release() method was to allow sequences like:
>
> b = bytearray()
> m1 = memoryview(b)
> m1.release() -> must call releasebuffer instantly.
> b.resize(10) -> this might fail otherwise if the garbage collection is too slow.
Well, that would still work with my proposal.
Now consider:
def some_library_function(byteslike):
with memoryview(byteslike) as m2:
# do something with m2
with memoryview(some_object) as m1:
some_library_function(m1)
...
print(m1[0])
That m1 becomes unusable after m2 is released in the library function is
completely counter-intuitive, and will make memoryviews a pain to use in
real life. |
|
Date |
User |
Action |
Args |
2011-07-05 15:46:41 | pitrou | set | recipients:
+ pitrou, teoliphant, mark.dickinson, ncoghlan, rupole, kermode, vstinner, pv, skrah, jcon, petri.lehtinen |
2011-07-05 15:46:40 | pitrou | link | issue10181 messages |
2011-07-05 15:46:40 | pitrou | create | |
|