r/learnpython • u/Nythious • Feb 20 '21
What are you having difficulty learning or are currently struggling to learn?
I'm curious what the community here has difficulty with when it comes to learning Python. Partly because I want to see if the more experienced community here (or myself) can help point you into the right direction. . . but also because I'm trying to come up with video tutorial ideas for future content and would love to hear from Python learners what would be most useful to dedicate our time on.
I'm looking forward to hearing what you guys have to say!
417
Upvotes
2
u/MaraudingAvenger Feb 21 '21 edited Feb 21 '21
--also I realized in my response I focused on the how instead of the why. Fellow DS guy here.
I should say, for things like transforms (I want to change all these things in some way),
mapis the way.For combining long things into one thing (works on iterables full of strings as well),
functools.reduceis the bee's knees.I don't use
filterall that much, tbh.Classes -> when they make sense and don't overcomplicate things! I like to use API wrappers to simplify things. Let's say I'm going to look up terms on Wiktionary, I can wrap that code into a Wiktionary object and do something like:
so I don't have to deal with either a bunch of functions, or a bunch of imperative code to do big lookups. Also that way I can share the Wiktionary class (or can publish wiki.py) to some internal repo, and other people can use it/don't have to reinvent the wheel when they are going to query wiktionary.
decorators -> almost never, but there are some big exceptions -- one decorator I probably overuse is one that I made to warn instead of error. It basically wraps a function in a try/except block, and pipes any exceptions to stderr. I use it to wrap calls to my company's notoriously janky internal APIs, so my program doesn't break because the API sucks.