0

do you have to know all functions ?

I understand that you don't have to memorize code but how can you know all the functions and their uses from the module you imported. thanks for any answer you give.

10th Sep 2020, 12:12 PM
Nshuti Alliance
Nshuti Alliance - avatar
6 Answers
+ 4
read the documentation for the module you imported, of course you don't have to know all the functions, that's why the search bars exists, just memorize the main ones that you'll use often.
10th Sep 2020, 12:19 PM
Bagon
Bagon - avatar
+ 4
You can use the dir function to get a list of all functions and variables from a namespace: dir(str) ---> list of string methods dir(math) ---> list of math methods You can use help to get documentation from certain functions or whole modules: help(str) help(math) help("math") help(math.sin) But you don't need to know all the functions, you need to know what you need for your project and where you can find the solutions. If you for example searched a function to remove a directory, you may know that os is a module offering useful methods for filehandling, import it and use the dir method: import os print(dir(os)) You get a big list, you can use some list filtering algorithms to make it easier to find, what you are possibly searching for. You would eventually find a name "rmdir" which sounds a logical name for an directory removing method, let's use help to make sure it is what we searched for: help("os.rmdir") It says that rmdir does what we expected, and we got information about how to use the method.
10th Sep 2020, 1:57 PM
Seb TheS
Seb TheS - avatar
+ 3
It is simple the more you practise the more they get into your brain just like typing and at least most compilers have autocomplete feature
10th Sep 2020, 12:20 PM
Kelvin Kiprop Kemboi
Kelvin Kiprop Kemboi - avatar
+ 2
I highly appreciate your answers thanks
10th Sep 2020, 8:44 PM
Nshuti Alliance
Nshuti Alliance - avatar
+ 2
Welcome
10th Sep 2020, 8:46 PM
Kelvin Kiprop Kemboi
Kelvin Kiprop Kemboi - avatar
+ 1
Yes we have not a memorize to do that ,but with the time of use it and work with it more and more we can store it in our mind dynamicly.
12th Sep 2020, 12:38 PM
Fareed
Fareed - avatar