You can check hidden code for modules using inspect, but only after you import the particular module and then import the inspect module --- try help(inspect)
>>> import randint
>>> from inspect import getsource
>>> getsource(randint) # here i am going to explore code for package called `randint`
you can simply use help() command to get help about builtin functions as well its code.
for eg: if you want to see the code for str() , simply type - help(str)
it will return like this,
Help on class str in module __builtin__:
str(object='') -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
hope that helps
Already have an account? Login
Enter your username or e-mail address to receive an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.
Coursera provides universal access to the world’s best education, partnering with top universities and organizations to offer courses online.
© 2018 Coursera Inc. All rights reserved.