how to determine for using c extension or not ?

Marco Buttu marco.buttu at gmail.com
Mon Aug 3 16:54:38 CEST 2015


On 03/08/2015 15:30, Skip Montanaro wrote:
> id() tells you nothing about the nature of the function. Use the
> inspect.isbuiltin():
> ...
> It's perhaps a bit poorly named, but "builtin" functions are those not
> written in Python. That is, those written in C or C++.

I think in the documentation there is an inconsistency about the term 
builtin. The "Built-in Functions" documentation says: """The Python 
interpreter has a number of functions and types built into it that are 
*always available*. They are listed here in
alphabetical order""".

https://docs.python.org/3/library/functions.html

The functions in the documentation list, are the same functions we get 
from the `builtins` module.

So, in the documentation we use the term built-in to indicate functions 
always available, whose names live in the builtin namespace.
Sometimes, as mentioned by Skip, we say that the term "buit-in function" 
is also referred to a function written in C:

https://docs.python.org/3/library/types.html#types.BuiltinFunctionType

By using the same word (built-in) to indicate either objects written in 
C or objects who live in the builtin namespace could be a bit muddler.


-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbuttu at oa-cagliari.inaf.it



More information about the Python-list mailing list