Limiting the size of List and making it Homogeneous

Erik Max Francis max at alcyone.com
Fri Jan 13 03:49:22 EST 2006


ankit wrote:

> Is it possible to limit the size of list in python.
> I want to make list of 5 elements. How can I achieve this thing in
> python. And one more thing can we declare list to store elements of
> same type as in c, C++ we can declare an
> array which can have 5 elements of type int.
> C, C++:
>    int intarr[5] 
> How can I achieve this kind of behavior ? 

Use a list and keep it of length 5.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   There are countless planets, like many island Earths ...
   -- Konstantin Tsiolkovsky



More information about the Python-list mailing list