Faster way to do this...

Will McGugan news at NOwillmcguganSPAM.com
Tue Mar 1 07:26:27 EST 2005


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



More information about the Python-list mailing list