[Python-ideas] bitwise operations on bytes
mwm-keyword-python.b4bdba at mired.org
Sun Aug 9 01:22:07 CEST 2009
On Sun, 09 Aug 2009 10:41:55 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
> > I think it's a very rarely used feature that is more likely to baffle
> > the casual reader.
> However there's currently no way to efficiently do
> bitwise operations en masse on raw bytes without
> converting to and from long integers, which doesn't
> seem very satisfactory. Refusing to provide this
> ability for the above reason sounds like purity
> beating practicality to me.
It seems to me that bytes are a container type. How many builtin
operators are there that operate on every element in any kind of
container (other than queries, many of which already work on bytes)?
It seems to me that what you really want is a high-performance array
module of some flavor. Isn't that part of what NumPy provides?
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the Python-ideas