Re: Faster way to do this...

2005-03-03 Thread Timo Virkkala
Harlin Seritt wrote: Roy, I like what you showed: nums = [a for a in range(100)] . My mistake for not expressing my question as well as I should have. Not only am I looking for a way to fill in 100 spots (more or less) in an array er... list, but I'd like to be able to do it in intervals of 2,

Re: Faster way to do this...

2005-03-02 Thread Robert Kern
Will McGugan wrote: Warren Postma wrote: Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Lately I've found myself commenting C++ code

Re: Faster way to do this...

2005-03-02 Thread Will McGugan
Warren Postma wrote: Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Lately I've found myself commenting C++ code with the equivalent P

Re: Faster way to do this...

2005-03-01 Thread Robert Kern
Harlin Seritt wrote: Roy, I like what you showed: nums = [a for a in range(100)] . My mistake for not expressing my question as well as I should have. Not only am I looking for a way to fill in 100 spots (more or less) in an array er... list, but I'd like to be able to do it in intervals of 2,

Re: Faster way to do this...

2005-03-01 Thread Harlin Seritt
Excellent point Warren. I have been working with Python for about 3 years in all, but only really seriously for about a year. I am still utterly amazed that near everything that takes me about 5 to 20 lines of code can be done in 1, 2 or 3 lines of Python code (when done correctly). It is very frus

Re: Faster way to do this...

2005-03-01 Thread Warren Postma
Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Rebirth. Then there was the phase of the python-newbie so enamored of map and lambda.

Re: Faster way to do this...

2005-03-01 Thread Roy Smith
Harlin Seritt <[EMAIL PROTECTED]> wrote: >I've got the following code: > >nums = range(0) >for a in range(100): > nums.append(a) > >Is there a better way to have num initialized to a list of 100 >consecutive int values? Step one would be to change the first line to nums = [] which is simpler a

Re: Faster way to do this...

2005-03-01 Thread Aaron Bingham
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? You mean like this? nums = range(100) ;-) -- --

Re: Faster way to do this...

2005-03-01 Thread Steve Holden
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Why not the simplest solution? a = range(100) regards Steve -- http://mail.python.org/mailman/listinfo/p

Re: Faster way to do this...

2005-03-01 Thread Will McGugan
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Isn't that equivalent to simply.. nums= range(100) Will McGugan -- http://mail.python.org/mailman/listinfo/