In article <[email protected]>,
=?ISO-8859-1?Q?Matthias_Gall=E9?=  <[email protected]> wrote:
>
>My problem is to replace all occurrences of a sublist with a new element.
>
>Example:
>Given ['a','c','a','c','c','g','a','c'] I want to replace all 
>occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).

What's your goal?  After you do this once, you cannot repeat the
operation with a different sublist because you are not tracking the
source of the numbers.  You might look into standard compression
algorithms for information about how to accomplish this.
-- 
Aahz ([email protected])           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to