[Python-3000] Droping find/rfind? (original) (raw)

Josiah Carlson jcarlson at uci.edu
Sat Aug 26 10:29:01 CEST 2006


Nick Coghlan <ncoghlan at gmail.com> wrote:

Ivan Krstić wrote: > Jean-Paul Calderone wrote: >> http://twistedmatrix.com/trac/browser/sandbox/itamar/cppreactor/fusion > > This is the same Itamar who, in the talk I linked a few days ago > (http://ln-s.net/D+u) extolled buffer as a very real performance > improvement in fast python networking, and asked for broader and more > complete support for buffers, rather than their removal. > > A bunch of people, myself included, want to use Python as a persistent > network server. Proper support for reading into already-allocated > memory, and non-copying strings are pretty indispensable for serious > production use.

A mutable bytes type with deque-like performance characteristics (i.e O(1) insert/pop at index 0 as well as at the end), as well as the appropriate mutating methods (like readinto()) should go a long way to meeting those needs.

The implementation of deque and the idea behind bytes are not compatible. Everything I've heard about the proposal of bytes is that it is effectively a C unsigned char[] with some convenience methods, very similar to a Python array.array("B"), with different methods. There is also an implementation in the Py3k branch.

Also, while I would have a use for bytes as currently implemented (with readinto() ), I would have approximately zero use for a deque-like bytes object (never mind that due to Python not allowing multi-segment buffers, etc., it would be functionally impossible to get equivalent time bounds).



More information about the Python-3000 mailing list