Where can I find Python’s methods?

Asked

Viewed 55 times

-1

Hello, I’d like to see how the default python methods are written, such as str.split(). I have looked in the folder where python was installed but could not find it. I wonder if you can see.

  • I think, that’s what you want: link

  • 1

    Download the python source code here

1 answer

2

If you just want to see the methods you can use already embedded in python, without seeing the implementations, you can use the

 dir(__builtins__) 

With this it will show all builtins methods available in python for you to use. If you want to have the documentation of a given method, just use the help function().

help(str.split)

This way you get the docstring of the method and you can know how it works. I think it is the ideal way to make queries to certain features of the language, because after studying you will know more is the methods and functions, it is if you need to remember the name of a function, or how it works, use the two methods passed above. Of course if you are still starting the ideal is a course for you to actually have a concrete learning not only of language, but also of good practices in language, techniques and everything else.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.