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


Groups > comp.lang.python > #24381

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'subject:How': 0.09; 'function,': 0.09; 'method,': 0.09; 'cc:addr:python-list': 0.10; 'sat,': 0.15; '23,': 0.16; 'function?': 0.16; "object's": 0.16; 'subject:array': 0.16; 'subject:object': 0.16; 'wrote:': 0.17; 'trying': 0.22; 'this:': 0.23; 'header:In-Reply-To:1': 0.23; 'defined': 0.24; 'message-id:@mail.gmail.com': 0.27; 'cc:2**0': 0.27; "doesn't": 0.28; 'cc:addr:python.org': 0.29; "i'm": 0.30; 'that.': 0.31; 'url:python': 0.31; 'subject:?': 0.33; 'turn': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'url:org': 0.35; 'possible': 0.37; 'subject:: ': 0.37; 'received:209': 0.37; 'pm,': 0.38; 'header:Received:5': 0.39; 'yes,': 0.60; 'calls': 0.62; 'subject:get': 0.81; 'received:209.85.217.174': 0.84; 'received:mail- lb0-f174.google.com': 0.84; 'url:cpython': 0.84; 'to:addr:yahoo.com': 0.85; 'do:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=2eK/NVBWLD7I7KY6HgAlLqWtEG1r4QGPulmzh2WJSS0=; b=rzuSZLz4qcGnnlpGS7T5QLZew6ywK7Sx5odXpfbkGnDj+66h750Aqe4ns/gw59VMqG YDFxPfNEFBM1Q+wO4XHMRlBD2gnPI+ndV+iNXjqk9z7GbDCslahsPhom467Hhbq4RyB2 A9T9A5WqoLZ2O/slldQGEsC580Jy69e46nf8XExJEUWpTx7HxGjTKqTSYtvgqpgeE7Ot uvHjQKCtjEUiRVkMHLrKakmcP1Y4KmuggZ/AobNiABXL8kq9JWVHBtf8DDHa20A8aq60 y136Vd1xYV0XsKNxWTO3M7Z8/+rz07koRMyOiL74UzL4Nh7F4Xtgic7zu96+FO4zTNjx euGA==
MIME-Version 1.0
In-Reply-To <1340504596.65359.YahooMailClassic@web164606.mail.gq1.yahoo.com>
References <1340504596.65359.YahooMailClassic@web164606.mail.gq1.yahoo.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sat, 23 Jun 2012 23:34:26 -0600
Subject Re: How can i call array_length to get the length of array object?
To gmspro <gmspro@yahoo.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1440.1340516098.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1340516098 news.xs4all.nl 6921 [2001:888:2000:d::a6]:36287
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24381

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web