Faster way to do this...

Aaron Bingham bingham at cenix-bioscience.com
Tue Mar 1 08:14:20 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?

You mean like this?

nums = range(100)

;-)

-- 
--------------------------------------------------------------------
Aaron Bingham
Software Engineer
Cenix BioScience GmbH
--------------------------------------------------------------------




More information about the Python-list mailing list