Message139883
| Author |
pitrou |
| Recipients |
jcon, kermode, mark.dickinson, ncoghlan, petri.lehtinen, pitrou, pv, rupole, skrah, teoliphant, vstinner |
| Date |
2011年07月05日.15:46:40 |
| SpamBayes Score |
1.9034845e-06 |
| Marked as misclassified |
No |
| Message-id |
<1309880753.3683.36.camel@localhost.localdomain> |
| In-reply-to |
<20110705153112.GA22571@sleipnir.bytereef.org> |
| Content |
> 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. |
|
History
|
|---|
| 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 |
|