Re: Code Opinion - Enumerate

2016-05-02 Thread Sayth Renshaw
As a reference here is a functional implementation of conways GOL. http://programmablelife.blogspot.com.au/2012/08/conways-game-of-life-in-clojure.html The author first does it in clojure and then transliterates it to python. Just good for a different view. Sayth -- https://mail.python.org/mail

Re: Code Opinion - Enumerate

2016-05-01 Thread Sayth Renshaw
Thanks for the opinion. I should add that is not my code in first post it's the code from Rosetta on how to do Conway's GOL. I thought it looked ugly. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Code Opinion - Enumerate

2016-05-01 Thread Stephen Hansen
On Sun, May 1, 2016, at 08:17 PM, Sayth Renshaw wrote: > Just looking for your opinion on style would you write it like this > continually calling range or would you use enumerate instead, or neither > (something far better) ? I can't comment on your specific code because there's too much noise to

Re: Code Opinion - Enumerate

2016-05-01 Thread Sayth Renshaw
Also not using enumerate but no ugly for i range implementation this one from code review uses a generator on live cells only. http://codereview.stackexchange.com/a/108121/104381 def neighbors(cell): x, y = cell yield x - 1, y - 1 yield x, y - 1 yield x + 1, y - 1 yield

Code Opinion - Enumerate

2016-05-01 Thread Sayth Renshaw
Looking at various Python implementations of Conway's game of life. I came across one on rosetta using defaultdict. http://rosettacode.org/wiki/Conway%27s_Game_of_Life#Python Just looking for your opinion on style would you write it like this continually calling range or would you use enumerate