How can i call array_length to get the length of array object?
gmspro
gmspro at yahoo.com
Sat Jun 23 23:40:54 EDT 2012
@Ignacio Mondino,
Doesn't it call this : http://hg.python.org/cpython/file/c0eab397f098/Python/bltinmodule.c#l1283 instead of this: http://hg.python.org/cpython/file/3b7230997425/Modules/arraymodule.c#l657
--- On Sat, 6/23/12, Ignacio Mondino <ignacio.mondino at gmail.com> wrote:
From: Ignacio Mondino <ignacio.mondino at gmail.com>
Subject: Re: How can i call array_length to get the length of array object?
To: "gmspro" <gmspro at yahoo.com>
Cc: "python-list" <python-list at python.org>
Date: Saturday, June 23, 2012, 10:34 PM
On Sat, Jun 23, 2012 at 11:23 PM, gmspro <gmspro at yahoo.com> wrote:
>
> Hi,
>
> I tried this,
> >>> import array
> >>> from array import array
> >>> arr=array('i',[5,7,8])
> >>> arr.sg_length
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'sg_length'
> >>> arr=array('i'[5,8,7])
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: string indices must be integers
> >>> arr=array('i',[5,8,7])
> >>> arr.length
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'length'
> >>> arr.length()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'length'
> >>> length(arr)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'length' is not defined
> >>> array_length(arr)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'array_length' is not defined
> >>> arr.array_length()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'array_length'
> >>> arr.array_length
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'array_length'
>
> I'm trying to call this function, http://hg.python.org/cpython/file/3b7230997425/Modules/arraymodule.c#l657
>
> Is that possible to call that function?
>
> I know it's possible to do:
> >>>len(arr)
> >>>arr.itemsize
>
> Any asnwer will be highly appreciated.
>
> Thanks.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
Hi,
something along the lines
>>> s = 'supercalifragilisticexpialidocious'
>>> len(s)
34
check http://docs.python.org/ for more on this.
Ignacio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120623/dd35a573/attachment.html>
More information about the Python-list
mailing list