Re: Size of list

2006-02-06 Thread Schüle Daniel
>>> lst = [1,2,3] >>> len(lst) 3 >>> lst.__len__() 3 in genereal all objects which implements __len__ can be passed to built-in function len >>> len just to give one example how this can be used >>> class X(object): ... def __len__(self): ... print "this instance has __len_

Re: Size of list

2006-02-06 Thread Ernesto
Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Size of list

2006-02-06 Thread limodou
6 Feb 2006 08:32:18 -0800, Ernesto <[EMAIL PROTECTED]>: > for line in PM_File_Handle.readlines(): > PM_fields = line.split(';') > > # Is there a way to get the size of PM_Fields here ? > # Something like > > size = PM_fields.size( ) > > # I could not find this attribute in the python docs.

Size of list

2006-02-06 Thread Ernesto
for line in PM_File_Handle.readlines(): PM_fields = line.split(';') # Is there a way to get the size of PM_Fields here ? # Something like size = PM_fields.size( ) # I could not find this attribute in the python docs. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread Mike C. Fletcher
?view=markup Note, however, that if you goal is to create a simple C-level pointer of machine ints you'll need to use Numpy or a similar system that implements such a type. Have fun, Mike ankit wrote: >Is it possible to limit the size of list in python. >I want to make list of 5 el

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread bearophileHUGS
The array module allows you to specify a single type of elements. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread gene tani
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 eleme

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread gene tani
gene tani wrote: > 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 dec

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread Erik Max Francis
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 eleme

Limiting the size of List and making it Homogeneous

2006-01-13 Thread ankit
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

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Terry Hancock
On Tuesday 01 March 2005 02:50 pm, Anthony Liu wrote: > Yes, that's helpful. Thanks a lot. > > But what if I wanna construct an array of arrays like > we do in C++ or Java: > > myArray [][] > > Basically, I want to do the following in Python: > > myArray[0][1] = list1 > myArray[1][2] = list2 >

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Michael Spencer
Anthony Liu wrote: Yes, that's helpful. Thanks a lot. But what if I wanna construct an array of arrays like we do in C++ or Java: myArray [][] Basically, I want to do the following in Python: myArray[0][1] = list1 myArray[1][2] = list2 myArray[2][3] = list3 here you have to be careful to create N

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Steven Bethard
Anthony Liu wrote: Yes, that's helpful. Thanks a lot. But what if I wanna construct an array of arrays like we do in C++ or Java: myArray [][] Basically, I want to do the following in Python: myArray[0][1] = list1 myArray[1][2] = list2 myArray[2][3] = list3 How to do this, gurus? You might be able

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Steven Bethard
Michael Spencer wrote: Anthony Liu wrote: I cannot figure out how to specify a list of a particular size. For example, I want to construct a list of size 10, how do I do this? A list does not have a fixed size (as you probably know) But you can initialize it with 10 somethings > >>> [None]*10 [N

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Anthony Liu
Yes, that's helpful. Thanks a lot. But what if I wanna construct an array of arrays like we do in C++ or Java: myArray [][] Basically, I want to do the following in Python: myArray[0][1] = list1 myArray[1][2] = list2 myArray[2][3] = list3 How to do this, gurus? --- Michael Spencer <[EMAIL P

Re: Is it possible to specify the size of list at construction?

2005-03-01 Thread Michael Spencer
Anthony Liu wrote: I cannot figure out how to specify a list of a particular size. For example, I want to construct a list of size 10, how do I do this? A list does not have a fixed size (as you probably know) But you can initialize it with 10 somethings > >>> [None]*10 [None, None, None, None, N

Is it possible to specify the size of list at construction?

2005-03-01 Thread Anthony Liu
I cannot figure out how to specify a list of a particular size. For example, I want to construct a list of size 10, how do I do this? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -