Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24381 > unrolled thread

Re: How can i call array_length to get the length of array object?

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2012-06-23 23:34 -0600
Last post2012-06-23 23:34 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How can i call array_length to get the length of array object? Ian Kelly <ian.g.kelly@gmail.com> - 2012-06-23 23:34 -0600

#24381 — Re: How can i call array_length to get the length of array object?

FromIan Kelly <ian.g.kelly@gmail.com>
Date2012-06-23 23:34 -0600
SubjectRe: How can i call array_length to get the length of array object?
Message-ID<mailman.1440.1340516098.4697.python-list@python.org>
On Sat, Jun 23, 2012 at 8:23 PM, gmspro <gmspro@yahoo.com> wrote:
> 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)

You call it just like that.  array_length is the C implementation of
__len__ for arrays.

> 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

Yes, and builtin_len calls PyObject_Size, which in turn calls the
object's sq_length method, which is defined to be array_length for
arrays.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web