Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-19 Thread Matt Smith
On Fri, 2007-05-18 at 17:03 -0500, Luke Paireepinart wrote: > see my other reply, Matt. > -Luke Apologies Luke, I have found your earlier post in the tutor archives - I don't seem to have received it from the list yet. Thanks for the help. Matt ___

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-19 Thread Luke Paireepinart
Matt Smith wrote: >> the possible combinations of values from the two tuples? >> see my other reply, Matt. >> -Luke >> > > Hi Luke, > > Sorry if I'm missing something but which other reply? > All the info in my other reply Alan reiterated, I believe. You can just subtract 1 from the total a

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-19 Thread Matt Smith
> the possible combinations of values from the two tuples? > see my other reply, Matt. > -Luke Hi Luke, Sorry if I'm missing something but which other reply? Matt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Luke Paireepinart
Matt Smith wrote: >>> Is there a better way of doing this? >>> >> Perhaps something like this: >> >> for n in (x, x+1, x-1): >> for m in (y, y+1, y-1): >> if matrix[n, m]: >> neighbour_count = neighbour_count + 1 >> >> > > I need to not text matrix[x][y] is there a simple wa

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Luke Paireepinart
Matt Smith wrote: > On Fri, 2007-05-18 at 23:49 +0200, Rikard Bosnjakovic wrote: > >> Something like this: >> >> try: >>the_index_outside_matrix_test() >> except IndexError: >> suppress_the_error() >> > > Thanks Rikard, > > I'm not sure how I would go about actually suppressing the er

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Matt Smith
> > Is there a better way of doing this? > > Perhaps something like this: > > for n in (x, x+1, x-1): > for m in (y, y+1, y-1): > if matrix[n, m]: > neighbour_count = neighbour_count + 1 > I need to not text matrix[x][y] is there a simple way to exclude this from the possible combi

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Matt Smith
On Fri, 2007-05-18 at 23:49 +0200, Rikard Bosnjakovic wrote: > Something like this: > > try: >the_index_outside_matrix_test() > except IndexError: > suppress_the_error() Thanks Rikard, I'm not sure how I would go about actually suppressing the error - what would suppress_the_error() actual

Re: [Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Rikard Bosnjakovic
On 5/18/07, Matt Smith <[EMAIL PROTECTED]> wrote: > I am not sure > how to suppress or avoid this error so that neighbour_count is not > incremented for indexes outside the matrix. Something like this: try: the_index_outside_matrix_test() except IndexError: suppress_the_error() > Is there

[Tutor] Help with excetion handing and making my code more efficient needed please

2007-05-18 Thread Matt Smith
Hi, I am trying to write a simple program to display Conway's Game Of Life. I have the bones of the program together but I'm struggling with the function that tests for and applies the rules of the game (the important bit). I have the current state of the game stored in a 2d matrix with each cell