Markov process representation

Scott David Daniels scott.daniels at acm.org
Wed Mar 15 16:31:50 EST 2006


kpp9c wrote:
> This is wicked! I am trying to get it to work and am frantically fixing
> tabs and spaces... 
It was cut and pasted from working code (which I pasted back to test).

> but isn't line 50:
> 
> self._all_states |= set(key[i] for key in probabilities)
> 
> an error? isn't it supposed to be:
> 
> self._all_states != set(key[i] for key in probabilities)
> 
Nope.  self._all_states is a set.  I am collecting all mentioned states
from the key.  Another way to do it is:
     self._all_states = set()
     for key in probabilities:
         self._all_states = set(key)
-- key is a order-tuple of states.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list