This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients BreamoreBoy, bmearns, josh.r
Date 2014-06-16.21:40:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402954809.15.0.685527436199.issue5888@psf.upfronthosting.co.za>
In-reply-to
Content
I see a few issues with this:

1. Changing the default behavior is a compatibility issue. I've written code that depends on exceptions being raised if slice assignment sizes don't match.
2. The performance cost is high; changing from rewriting in place to shrinking or expanding slice assignment requires (in different orders for shrink/expand) truncating the file to the correct length, memcpy-ing data proportionate to the data after the end of the slice (not proportionate to the slice size) and probably remapping the file (which causes problems if someone has a buffer attached to the existing mapping). At least with non-file backed sequences, when we do work like this it's all in memory and typically smallish; with a file, most of it has to be read from and written to disk, and I'd assume the data being worked with is "largish" (if it's reliably small, the advantages of mmap-ing are small).
3. Behavior in cases where the whole file isn't mapped is hard to intuit or define reasonably. If I map the first 1024 bytes of a 2 GB file, and I add 20 bytes in the middle of the block, what happens? Does data from the unmapped portions get moved? Overwritten? What about removing 20 bytes from the middle of the block? Do we write 0s, or copy down the data that appears after? And remember, for all but the "shrink and write 0s" option, we're moving or modifying data the user explicitly didn't mmap.
History
Date User Action Args
2014-06-16 21:40:09josh.rsetrecipients: + josh.r, bmearns, BreamoreBoy
2014-06-16 21:40:09josh.rsetmessageid: <1402954809.15.0.685527436199.issue5888@psf.upfronthosting.co.za>
2014-06-16 21:40:09josh.rlinkissue5888 messages
2014-06-16 21:40:08josh.rcreate