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


Groups > comp.lang.python > #43828

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

Date 2013-04-18 15:50 +0200
From aaB <mecagonoisician@gmail.com>
Subject Re: a couple of things I don't understand wrt lists
References <20130416153701.GA18377@gmail.com> <CAPTjJmqRB0eiG9peDOU+Ow_1rqq2u=xXcUduyxUm3gAhrzMjHg@mail.gmail.com> <20130417102537.GA19967@gmail.com> <20130418130101.GA22185@gmail.com> <516FF3CA.7030407@davea.name>
Newsgroups comp.lang.python
Message-ID <mailman.769.1366293048.3114.python-list@python.org> (permalink)

Show all headers | View raw


> 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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web