I'm trying to see source code for python's build in functions like str.lower()
or str.lstrip()
. I was trying inspect.getsource()
but this didn't work. Is there any other way to view source codes for built ins?
Asked
Active
Viewed 42 times
0

Mat
- 202,337
- 40
- 393
- 406

TheStrangeQuark
- 2,257
- 5
- 31
- 58
-
I always found a tad difficult finding information about the details of the C implementation of Python's basic types. Regular IDEs won't do a good job because they're coded in C, and they've been compiled (so there's no _source_) It takes some googling in a per-case basis... http://www.laurentluce.com/posts/python-string-objects-implementation/ You have the repository with the source code here: https://www.python.org/downloads/source/ – Savir Mar 01 '15 at 17:49
-
What version of Python? What bitness (x86, x86-64?) – IronManMark20 Mar 01 '15 at 18:02
-
`inspect` won't work because the source code for those methods **isn't in Python**. Why do you want to see it? – jonrsharpe Mar 01 '15 at 18:03