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 ncoghlan
Recipients Ramchandra Apte, abarnert, cameron, christian.heimes, cowlicks, georg.brandl, gregory.p.smith, gvanrossum, josh.r, martin.panter, ncoghlan, pitrou, rhettinger, scoder, serhiy.storchaka, socketpair, terry.reedy, vstinner
Date 2018-05-19.04:47:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526705230.47.0.682650639539.issue19251@psf.upfronthosting.co.za>
In-reply-to
Content
I think Antoine's right that another venue (such as python-ideas) might be a better venue for this discussion, but I'll still try to explain the potential analogy I see to bytes.upper()/.lower()/etc: those operations let you treat ASCII segments in otherwise binary data as ASCII text, *without* needing to convert them to str first. While doing the str conversion is more formally correct, being able to stay in the raw binary domain frequently offers significant practical benefits by reducing both the runtime performance overhead and the amount of code needed.

Offering bitwise operations for bytes segments of equal length (perhaps via memoryview, or a memoryview subclass that only supports C-contiguous views) *might* turn out to offer a similar benefit when it comes to manipulating sections of a data buffer that represent integers (or anything else with a well-defined binary representation). With the right buffer exporter, you could even use it for direct bit-bashing of memory-mapped registers (which then gets quite interesting in the context of MicroPython applications).
History
Date User Action Args
2018-05-19 04:47:10ncoghlansetrecipients: + ncoghlan, gvanrossum, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, pitrou, scoder, vstinner, christian.heimes, cameron, socketpair, Ramchandra Apte, martin.panter, serhiy.storchaka, abarnert, josh.r, cowlicks
2018-05-19 04:47:10ncoghlansetmessageid: <1526705230.47.0.682650639539.issue19251@psf.upfronthosting.co.za>
2018-05-19 04:47:10ncoghlanlinkissue19251 messages
2018-05-19 04:47:09ncoghlancreate