Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78377
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'attribute': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; "wouldn't": 0.14; 'attribute,': 0.16; 'callable': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'stefan': 0.19; 'header:User-Agent:1': 0.23; 'either.': 0.24; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; 'absolute': 0.30; 'strongly': 0.30; "i'm": 0.30; 'code': 0.31; 'too.': 0.31; 'inspect': 0.31; 'sep': 0.31; 'running': 0.33; 'fri,': 0.33; 'implemented': 0.33; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'behind': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'times': 0.62; '26,': 0.68; 'certain,': 0.84; 'inexpensive': 0.84; 'subject:tell': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: any way to tell at runtime whether a callable is implemented in Python or C ? |
| Date | Fri, 26 Sep 2014 14:12:25 +0200 |
| References | <m035kl$54v$1@ger.gmane.org> <CAPTjJmpg1LkHk4FDSQX30Tusdw_9=+iVUDXyntLN1TVrbX4U7g@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | dslb-084-056-034-036.084.056.pools.vodafone-ip.de |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 |
| In-Reply-To | <CAPTjJmpg1LkHk4FDSQX30Tusdw_9=+iVUDXyntLN1TVrbX4U7g@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14393.1411733564.18130.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1411733564 news.xs4all.nl 2855 [2001:888:2000:d::a6]:54900 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:78377 |
Show key headers only | View raw
Chris Angelico schrieb am 26.09.2014 um 10:42: > On Fri, Sep 26, 2014 at 5:47 PM, Wolfgang Maier wrote: >> is there any reliable and inexpensive way to inspect a callable from running >> Python code to learn whether it is implemented in Python or C before calling >> into it ? > > I'm not sure you can say for absolute certain, but the presence of a > __code__ attribute is strongly suggestive that there's Python code > behind the function. That might be good enough for your purposes. Cython implemented native functions have a "__code__" attribute, too. Their current "__code__.co_code" attribute is empty (no bytecode), but I wouldn't rely on that for all times either. Stefan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: any way to tell at runtime whether a callable is implemented in Python or C ? Stefan Behnel <stefan_ml@behnel.de> - 2014-09-26 14:12 +0200
csiph-web