Re: Help doing it the python way

2012-05-29 Thread Jan Kuiken
On 5/24/12 22:22 , Scott Siegler wrote: I am an experienced programmer but a beginner to python. As such, I can figure out a way to code most algorithms using more C style syntax. I am doing something now that I am sure is a more python way but i can't quite get it right. I was hoping

Re: Help doing it the python way

2012-05-29 Thread Arnaud Delobelle
On 24 May 2012 21:22, Scott Siegler scott.sieg...@gmail.com wrote: Hello, I am an experienced programmer but a beginner to python.  As such, I can figure out a way to code most algorithms using more C style syntax. I am doing something now that I am sure is a more python way but i can't

Re: Help doing it the python way

2012-05-26 Thread Nobody
On Thu, 24 May 2012 13:22:43 -0700, Scott Siegler wrote: is there a way to do something like: [(x,y-1), (x,y+1) for zzz in coord_list] or something along those lines? [(xx,yy) for x, y in coord_list for xx, yy in [(x,y-1),(x,y+1)]] or: [(x,yy) for x, y in coord_list for yy in

Re: Help doing it the python way

2012-05-25 Thread Ian Kelly
On Thu, May 24, 2012 at 5:12 PM, Emile van Sebille em...@fenx.com wrote: On 5/24/2012 2:30 PM Paul Rubin said... Paul Rubinno.email@nospam.invalid  writes:     new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) Sorry:    new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in

Re: Help doing it the python way

2012-05-24 Thread Duncan Booth
Scott Siegler scott.sieg...@gmail.com wrote: Hello, I am an experienced programmer but a beginner to python. As such, I can figure out a way to code most algorithms using more C style syntax. I am doing something now that I am sure is a more python way but i can't quite get it right.

Re: Help doing it the python way

2012-05-24 Thread Paul Rubin
Scott Siegler scott.sieg...@gmail.com writes: is there a way to do something like: [(x,y-1), (x,y+1) for zzz in coord_list] or something along those lines? You should read the docs of the itertools module on general principles, since they are very enlightening in many ways. Your

Re: Help doing it the python way

2012-05-24 Thread Dave Angel
On 05/24/2012 04:22 PM, Scott Siegler wrote: Hello, I am an experienced programmer but a beginner to python. As such, I can figure out a way to code most algorithms using more C style syntax. I am doing something now that I am sure is a more python way but i can't quite get it right. I

Re: Help doing it the python way

2012-05-24 Thread Paul Rubin
Paul Rubin no.email@nospam.invalid writes: new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) Sorry: new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in coord_list)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help doing it the python way

2012-05-24 Thread Emile van Sebille
On 5/24/2012 2:30 PM Paul Rubin said... Paul Rubinno.email@nospam.invalid writes: new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) Sorry: new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in coord_list)) from itertools import chain coord_list =

Re: Help doing it the python way

2012-05-24 Thread Terry Reedy
On 5/24/2012 4:53 PM, Duncan Booth wrote: Scott Sieglerscott.sieg...@gmail.com wrote: Hello, I am an experienced programmer but a beginner to python. As such, I can figure out a way to code most algorithms using more C style syntax. Hi, welcome to Python. I came here from C also. I am