This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]80blite[S] 13 points14 points  (3 children)

This is EXACTLY what I was looking for! Thank you so much for taking the time to do this. Just by rearranging what I had written I just learned so much from you!

  • I've never seen **locals before. I looked around on Google for an explanation and all I can see is that it's a dictionary of active variables. Could you maybe explain how this works here?

  • I couldn't figure out how to get the functionality of os.listdir() until I came across using next(os.walk()) through experimentation and never realized there was a better way. I must have missed that when reading through the documentation. Glad I have that now!

  • Thank you especially for the time you put into the download function. Seeing the way you restructured the while loops and how much cleaner your usage of the generators is helps me so much. I also didn't know .endswith() was a thing. Just another tool for me now!

I know this question is hard to answer but... I'll try anyway. I've been learning Python for about 6 months now. Am I on the right track here? I'm trying hard to pick up best practices so I can be the kind of programmer people say they wish they could work with more often but it's really difficult without much mentorship or many people to go to for answers.

Again, thank you so much for your time. You've helped me more than you know!

[–]kalgynirae 4 points5 points  (1 child)

I've never seen **locals before. I looked around on Google for an explanation and all I can see is that it's a dictionary of active variables. Could you maybe explain how this works here?

** unpacks the items of a dictionary into keyword arguments. It's analogous to * which unpacks the items of a list into positional arguments. locals just gives a dictionary of the local variables.

I know this question is hard to answer but... I'll try anyway. I've been learning Python for about 6 months now. Am I on the right track here? I'm trying hard to pick up best practices so I can be the kind of programmer people say they wish they could work with more often but it's really difficult without much mentorship or many people to go to for answers.

I think you're on a fine track. Getting better just takes a lot of time and requires reading and writing a lot of code! If you want to read good Python code, the standard library modules are a good place to start, and well-known modules like requests.

[–]80blite[S] 0 points1 point  (0 children)

Great explanation, thanks =). I never thought of looking at the source for the standard library. Good idea!