On 24 May 2012 21:22, 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 rig
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 som
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 i
On Thu, May 24, 2012 at 5:12 PM, Emile van Sebille wrote:
> On 5/24/2012 2:30 PM Paul Rubin said...
>
>> Paul Rubin 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))
>
>
>
>>>
On 5/24/2012 4:53 PM, Duncan Booth wrote:
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.
Hi, welcome to Python. I came here from C also.
I am doing something now tha
On 5/24/2012 2:30 PM Paul Rubin said...
Paul Rubin 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 = zip(range(20,30),range(30,40))
>>> a =
Paul Rubin 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
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 ri
Scott Siegler 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 particular problem
can be hand
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 was hoping
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 was hoping someone might help.
So I have a list
11 matches
Mail list logo