Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

source code of python inbuilt functions [duplicate]

I have used type() function in my program...

I just want to know how does Python implement this? Or where could I find the source code file that implement this function?

like image 864
Rahul Gupta Avatar asked Aug 31 '26 20:08

Rahul Gupta


2 Answers

The type() function is implemented in C. Here's a link to the source: http://hg.python.org/cpython/file/0f837071fd97/Objects/typeobject.c

like image 114
Raymond Hettinger Avatar answered Sep 02 '26 10:09

Raymond Hettinger


In general

import multiprocessing
multiprocessing.__path__
multiprocessing.__file__

__path__ yields location of the library __file__ yields complete path of the file.

If above didn't work, you need to look into python development source code.

Regarding type source code, Raymond Hettinger's answer is correct.

like image 25
Kracekumar Avatar answered Sep 02 '26 10:09

Kracekumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!