how to determine for using c extension or not ?
steve at pearwood.info
Mon Aug 3 15:36:47 CEST 2015
On Mon, 3 Aug 2015 03:47 pm, umedoblock wrote:
> Hello everyone.
> I use bisect module.
You asked the same question FOUR times. Have patience. Your question goes
all over the world, people may be asleep, or working, or just not know the
answer. If you ask a question, and get no answers, you should wait a full
day before asking again.
> bisect module developer give us c extension as _bisect.
> If Python3.3 use _bisect, _bisect override his functions in bisect.py.
So does Python 2.7.
> now, I use id() function to determine for using c extension or not.
The id() function doesn't tell you where objects come from or what language
they are written in. But they will tell you if two objects are the same
>>>> import bisect
>>>> import _bisect
> they return 139679893708880 as id.
> so i believe that i use c extension.
Also, you can do this:
py> import bisect
py> bisect.bisect.__module__ # Where does the bisect file come from?
py> import _bisect
So you can see that _bisect is a .so file (on Linux; on Windows it will be
a .dll file), which means written in C.
More information about the Python-list