How to see the source code of a function in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to see the source code of a function in python?

For example sha256 encoding function

11th Apr 2020, 4:11 AM
karangreat
karangreat - avatar
5 Answers
+ 6
11th Apr 2020, 4:24 AM
Daljeet Singh
Daljeet Singh - avatar
+ 2
The source code for Python's built-in functions is written in c and can only be accessed by looking at the Python's source code (hosted on Mercurial or downloadable from https://www.python.org/downloads/source/)​. But you can get source code of methods and defined functions: https://code.sololearn.com/cE8HJLBJXSPK/?ref=app
11th Apr 2020, 4:50 AM
Tricker
+ 1
Daljeet Singh it is working but only for user defined functions not for inbuilt function 😞 https://code.sololearn.com/cAHsIKZvIkoC/?ref=app
11th Apr 2020, 4:36 AM
karangreat
karangreat - avatar
11th Apr 2020, 4:53 AM
karangreat
karangreat - avatar
0
karangreat Yeah, that is because it is coded in c language.
11th Apr 2020, 4:59 AM
Tricker