[EMAIL PROTECTED] wrote:
>     Nick> I wouldn't mind seeing some iteration-in-C bit-bashing operations
>     Nick> in there eventually...
> 
>     Nick>    data = bytes([x & 0x1F for x in orig_data])
> 
> This begins to make it look what you want is array.array or nump.array.
> Python's arrays don't support bitwise operations either, but numpy's do.
> How much overlap is there between the three types?  Does it make sense to
> consider that canonical underlying array type now (or in the near future,
> sometime before the release of 3.0 final)?

Not hugely urgent for me - it's a direction I'd like to see the data 
type go in (as the less custom code needed on the C/C++ side of the 
fence to do reasonably efficient low level I/O the better as far as I am 
concerned), but work is still on 2.4 (with no compelling motivation to 
upgrade) so I'm personally resigned to the use of assorted ord(), chr() 
and ''.join() calls for the immediate future.

The advantage of having the bit manipulation features in the builtin 
bytes type for this kind of thing over numpy.array is that I expect the 
builtin bytes type to be usable directly with Py3k versions of libraries 
like pyserial, and numpy would be a big dependency to bring in just to 
get more efficient bit-oriented operations on a byte sequence - 
array.array doesn't have them (not to mention the fact that these 
operations would make far less sense for any array containing something 
other than bytes).

However, because the addition of any bit-oriented operations to the 
bytes/buffer types would be a new backwardly-compatible feature, it can 
be proposed whenever is convenient rather than having to be done right now.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to