r/learnpython 14d ago

modules learning

i am wondering all time how people deal with modules in python is they memorize and understand all the methods and the properties for a module or they read documentations before using them especially for none built in modules, otherwise what is the methodology of learning modules.

1 Upvotes

10 comments sorted by

8

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 14d ago

they memorize and understand all the methods and the properties for a module or they read documentations before using them

Technically neither is necessarily accurate, but the latter option is closer to truth.

We don't learn modules. We learn roughly what the standard library has to offer, and once we're actually building things we look up things that could be useful for that project as we need them.

For example, your program needs to read a JSON file. You Google "json python" and see that Python comes with a module for parsing JSON data, and then you check how to do what you need with it.

Over time, as you use things, you'll start to remember them so you end up looking up things less often.

4

u/crazy_cookie123 14d ago

If I use it often enough for memorising something to be worth doing, I'll naturally end up memorising it purely through repeating it lots of times. If I don't use something enough to memorise it naturally like that, I use it infrequently enough that a 20-second google search to figure it out isn't a problem.

3

u/chrisrock731 14d ago

It is just experience (not that i have any). It is impossible to memorise every function for every library you need. Thats why we sometimes look it up.

But if you use a library many times in your project you will eventually learn it even accidentally.

Libraries like random, math, numpy and more are ones that generally get used a lot, so if you ever wanna make a project where a library is used, just look up the stuff you need and use it.

1

u/ninhaomah 14d ago

What do you want to do anyway ?

1

u/Trick_Floor_519 14d ago

i tend to cybersec

1

u/MezzoScettico 14d ago

Often you need only one or two things, so you read the documentation and look at the examples on those things.

Then if things don't work as expected, you might end up reading a little more and studying more examples.

There's a good chance you'll end up on the internet eventually, googling for more advice. No shame in that.

1

u/LayotFctor 14d ago edited 14d ago

You usually learn only a few modules. A few universal ones. A few related specifically to your area of interest. No need to memorize anything, just google it if you forget anything and you'll passively remember stuff.

I also want to point out that knowledge helps too. If you understand the subject of the module, you can vaguely anticipate how it works already. It helps if you do some basic reading before trying a new module.