efficient in-place byte modifications

Cimarron Taylor cimarron+google at taylors.org
Wed Aug 15 13:11:28 EDT 2001


Hi, I'm looking into using python to prototype a program
which will read, process and retransmit network packets
using a simple pair threads and a pool of packet buffers.

At first glance, it seems Python has all the networking 
and threading operations I need.  The thing is, I need to 
do a lot of separate in-place modifications of the contents 
of the packets, so using (immutable) strings for packets 
probably won't work.

I think my remaining options are to:

1. use the array module for the buffers
2. figure out how to use the "coming-soon" buffer object
   and the readinto call
3. code the buffers in C and wrap accordingly
4. do something else (use tuples?)

I'd like to ask the members of this list a more general
question: what is the right Python object to use for a 
system which needs to support efficient storage and modifcation 
of the contents of lots of relatively small objects.

I suspect everyone is going to tell me to do #3 but I'd 
rather code everything in Python if possible.

Thank you,

Cimarron Taylor



More information about the Python-list mailing list