r/learnpython • • 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

324 comments sorted by

View all comments

Show parent comments

14

u/Ijustlikepotatoes Feb 20 '21

Me when I read python code:

"Mhm yes, oh yeah that. Yep I know some of these words"

Me when I see the @ :

"HnnnngksjdjdkddokdAaaaAwtf"

3

u/keraj93 Feb 20 '21

decorator simply add some functionality to functions

it is for example common with webframeworks like django. Webpages are basically defined by functions. When you want to restrict the access to a webpage only to authenticated users you simply add @login_required above the function. You can also add arguments to decoraters. with the example of @login_required, you can add an argument that defines where a non-authenticated user is redirected to because he/she has no access to the page.

2

u/Ijustlikepotatoes Feb 20 '21

Oh yeah I understood that in a flask/django setting. But anything outside of it makes things confusing.

Then there is decorators like @classmethod and such...

Ive got a lot to learn :')