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


Groups > comp.lang.python > #18761

Re: C-API: Pass a tuple to a method of a class

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.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 <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'c/c++': 0.05; '"""': 0.07; 'admit': 0.09; 'context.': 0.09; 'declarations': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:method': 0.09; 'api': 0.09; 'exception': 0.12; 'float': 0.13; 'exceptions.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'received:mnet-online.de': 0.16; 'subject:API': 0.16; 'swallows': 0.16; '(or': 0.22; 'header:In-Reply-To:1': 0.22; "shouldn't": 0.23; 'noticed': 0.24; 'stefan': 0.24; 'code.': 0.26; 'helpful': 0.26; 'module': 0.26; 'import': 0.27; 'url:src': 0.30; 'least': 0.30; "isn't": 0.33; 'header:User-Agent:1': 0.33; 'header:X -Complaints-To:1': 0.33; 'to:addr:python-list': 0.34; 'calling': 0.34; 'here,': 0.35; 'external': 0.35; 'skip:" 10': 0.37; 'but': 0.37; 'page': 0.37; 'using': 0.38; 'received:org': 0.38; 'url:docs': 0.39; 'received:de': 0.39; 'url:org': 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'order': 0.62; 'enable': 0.62; 'it)': 0.67; 'received:93': 0.78; 'citation': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: C-API: Pass a tuple to a method of a class
Date Tue, 10 Jan 2012 15:05:20 +0100
References <ea-mime-4f0c19a2-3df4-7b628f3f@webmail.numericable.fr> <jehb6d$ijh$1@dough.gmane.org> <jehcra$ut6$1@dough.gmane.org> <CAGZyxufS1tzjDmpu3xBDKsKOL8ncaSrQCOC_MiBHp2cb+tpTnA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host ppp-93-104-6-76.dynamic.mnet-online.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0
In-Reply-To <CAGZyxufS1tzjDmpu3xBDKsKOL8ncaSrQCOC_MiBHp2cb+tpTnA@mail.gmail.com>
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.4596.1326204337.27778.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326204337 news.xs4all.nl 6925 [2001:888:2000:d::a6]:53131
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18761

Show key headers only | View raw


[cleaned up top-posted citation order to make the replies readable]

刘振海, 10.01.2012 14:24:
> 2012/1/10 Stefan Behnel
>> """
>> # in module "gluecode.pyx" (or whatever you want to name it)
>>
>> import mModule8
>>
>> cdef api float compute_norm(float init_value, float x, float y, float z):
>>    vec = mModule8.cVector(init_value)
>>    return vec.ComputeNorm( (x,y,z) )
>> """

I just noticed that this swallows exceptions. It should have one of the
"except" declarations at the end of the signature to enable proper
exception signalling to the calling C/C++ code.

http://docs.cython.org/src/userguide/language_basics.html#error-return-values


> I have been using Cython for a period of time. But I can not find a
> description for the "api" key word in Cython documents

I admit that searching for "api" isn't really helpful here, but at least
the page on "interfacing with external C code" shouldn't be all that hard
to find in the given context. It contains this section:

http://docs.cython.org/src/userguide/external_C_code.html#using-cython-declarations-from-c

Stefan

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


Thread

Re: C-API: Pass a tuple to a method of a class Stefan Behnel <stefan_ml@behnel.de> - 2012-01-10 15:05 +0100

csiph-web