[Python-ideas] Bitwise operations on bytes class

Stefan Behnel stefan_ml at behnel.de
Mon Jun 16 21:55:40 CEST 2014


Nathaniel McCallum, 16.06.2014 21:43:
> Perhaps some code will clarify what I'm proposing. Attached is a class I
> have found continual reuse for over the last few years. It implements
> bitwise operators on a bytes subclass. Something similar could be done
> for bytearray.

Ok, according to your code, you don't want a SIMD type but rather an
arbitrary size integer type. Why don't you just use the "int" ("long" in
Py2) type for that? It has way faster operations than your multiple copy
implementation.

Stefan




More information about the Python-ideas mailing list