a couple of things I don't understand wrt lists

aaB mecagonoisician at gmail.com
Thu Apr 18 09:50:44 EDT 2013


> The second guess, more likely, is that you're using "is" to compare
> numbers, and that's never a safe idea.  It might happen to work for
> small numbers, but you should be using ==.
The second guess was right, changing "is" for "==" solved it, thanks.
I still have a lot to learn about python semantics.

The 8 bit pattern is used to store the rule, not the cells.
To compute the next cell, I index the rule list, based on the values of that cell
and it's two immediate neighbours in the previous generation.
This probably isn't the simplest way.
Since I am using only 3 cells to compute 1 cell, the biggest index would be
2**3 - 1, hence the 8bit pattern for the rule.



More information about the Python-list mailing list