efficient in-place byte modifications
Chris Barker
chrishbarker at home.net
Wed Aug 15 18:21:18 EDT 2001
Cimarron Taylor wrote:
>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
This sounds perfect to me...
> 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?)
Tuples won't work, they are immutable, so you can't change just one item
without re-building hte whole thing. Lists would work, but there is no
native one-byte data type, so you would ahve a list of one character
stings, which might be a bit much overhead.
Youd also use NumPy arrays (http://sourceforge.net/projects/numpy), I'm
not sure they will give you anything you can't gt from the array module
for your purpose, but they have a lot of other nifty features!
-Chris
--
Christopher Barker,
Ph.D.
ChrisHBarker at home.net --- --- ---
http://members.home.net/barkerlohmann ---@@ -----@@ -----@@
------@@@ ------@@@ ------@@@
Oil Spill Modeling ------ @ ------ @ ------ @
Water Resources Engineering ------- --------- --------
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------
More information about the Python-list
mailing list