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


Groups > comp.lang.python > #78371

Re: any way to tell at runtime whether a callable is implemented in Python or C ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.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; 'languages,': 0.04; 'classes,': 0.05; 'subject:Python': 0.06; 'method,': 0.09; 'methods,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '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; 'types,': 0.16; 'subject: ?': 0.16; 'stefan': 0.19; 'header:User-Agent:1': 0.23; '(or': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'mix': 0.30; 'code': 0.31; 'inspect': 0.31; 'running': 0.33; 'implemented': 0.33; 'objects': 0.35; 'received:84': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'more': 0.64; 'different': 0.65; 'case?': 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 09:59:52 +0200
References <m035kl$54v$1@ger.gmane.org>
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 <m035kl$54v$1@ger.gmane.org>
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.14388.1411718412.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411718412 news.xs4all.nl 2850 [2001:888:2000:d::a6]:44017
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78371

Show key headers only | View raw


Wolfgang Maier schrieb am 26.09.2014 um 09:47:
> 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 ?

Not really. Both can have very different types and very different
interfaces. There are types, classes, functions, methods, objects with a
dedicated __call__() method, ... Any of them can be implemented in Python
or C (or other native languages, or a mix of more than one language).

What's your use case? There might be other ways to achieve what you want.

Stefan

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


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 09:59 +0200

csiph-web