Message203700
| Author |
Lluís |
| Recipients |
Lluís |
| Date |
2013年11月21日.23:46:46 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1385077606.25.0.863226598696.issue19686@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The following code works without raising any AssertionError
>>> n = "some small integer value"
>>> m = "some larger integer value"
>>> assert n<m
>>> data = bytearray(n)
>>> mem = memoryview(data)
>>> assert mem==mem[:]
>>> assert mem==mem[0:]
>>> assert mem==mem[:m]
However, the different slices have different IDs, failing on the following asserts:
>>> assert id(mem)==id(mem[:])
>>> assert id(mem)==id(mem[0:])
>>> assert id(mem)==id(mem[:m])
Is the interpreter copying unnecessary data in these type of slices? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年11月21日 23:46:46 | Lluís | set | recipients:
+ Lluís |
| 2013年11月21日 23:46:46 | Lluís | set | messageid: <1385077606.25.0.863226598696.issue19686@psf.upfronthosting.co.za> |
| 2013年11月21日 23:46:46 | Lluís | link | issue19686 messages |
| 2013年11月21日 23:46:46 | Lluís | create |
|