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

Discussion in 'Python' started by Ian Kelly, Jun 24, 2012.

  1. Ian Kelly

    Ian Kelly Guest

    On Sat, Jun 23, 2012 at 8:23 PM, gmspro <> 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.
     
    Ian Kelly, Jun 24, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mitchua
    Replies:
    5
    Views:
    2,834
    Eric J. Roode
    Jul 17, 2003
  2. Ignacio Mondino
    Replies:
    0
    Views:
    303
    Ignacio Mondino
    Jun 24, 2012
  3. Stefan Behnel
    Replies:
    0
    Views:
    236
    Stefan Behnel
    Jun 24, 2012
  4. Mark Lawrence
    Replies:
    2
    Views:
    265
    Terry Reedy
    Jun 25, 2012
  5. Antoon Pardon
    Replies:
    0
    Views:
    240
    Antoon Pardon
    Jun 25, 2012
Loading...

Share This Page