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 dw
Recipients benjamin.peterson, dw, hynek, kmike, pitrou, scoder, serhiy.storchaka, skrah, stutzbach
Date 2014-07-22.20:31:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406061099.44.0.951082069508.issue22003@psf.upfronthosting.co.za>
In-reply-to
Content
Stefan, I like your new idea. If there isn't some backwards compatibility argument about mmap.mmap being hashable, then it could be considered a bug, and fixed in the same hypothetical future release that includes this BytesIO change. The only cost now is that to test for hashability, we must hash the object, which causes every byte in it to be touched (aka. almost 50% the cost of a copy)

If however we can't fix mmap.mmap due to the interface change (I think that's a silly idea -- Python has never been about letting the user shoot themselves in the foot), then the specialized-for-Bytes approach is almost as good (and perhaps even better, since the resulting concept and structure layout is more aligned with Serhiy's patch in issue15381).

tl;dr: 

a) mmap.mmap can be fixed - use hashability as strong test for immutability (instead of ugly heuristic involving buffer blags)
   - undecided: is calling hash(obj) to check for immutability too costly?

b) mmap.mmap can't be fixed - use the Bytes specialization approach.
History
Date User Action Args
2014-07-22 20:31:39dwsetrecipients: + dw, pitrou, scoder, benjamin.peterson, stutzbach, skrah, hynek, serhiy.storchaka, kmike
2014-07-22 20:31:39dwsetmessageid: <1406061099.44.0.951082069508.issue22003@psf.upfronthosting.co.za>
2014-07-22 20:31:39dwlinkissue22003 messages
2014-07-22 20:31:39dwcreate