Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43828 > unrolled thread

Re: a couple of things I don't understand wrt lists

Started byaaB <mecagonoisician@gmail.com>
First post2013-04-18 15:50 +0200
Last post2013-04-18 15:50 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: a couple of things I don't understand wrt lists aaB <mecagonoisician@gmail.com> - 2013-04-18 15:50 +0200

#43828 — Re: a couple of things I don't understand wrt lists

FromaaB <mecagonoisician@gmail.com>
Date2013-04-18 15:50 +0200
SubjectRe: a couple of things I don't understand wrt lists
Message-ID<mailman.769.1366293048.3114.python-list@python.org>
> 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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web