>>> 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_
Thanks !
--
http://mail.python.org/mailman/listinfo/python-list
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.
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
?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
The array module allows you to specify a single type of elements.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
>
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
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
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
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
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
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
-
17 matches
Mail list logo