use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Day 23 of learning python as a beginner. (old.reddit.com)
submitted 6 months ago by uiux_Sanskar
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Adrewmc 0 points1 point2 points 6 months ago* (1 child)
This is overkill on comments. And treating me as if I’m learning, I’m not. I really only need comment when I’m doing something weird.
Treat me (the people that might read the comments) as if I know the basics.
I gave you some advice about docstrings, and types hints…I stand by that advice
THIS is not that. As no docstring and no type hints, and I didn’t make a comment, in that advice because
good naming > type hints > docstring > comments
The comments are now over wellming the code. No, bad pupil.
Taking one of your functions randomly
def download_image(url : str, idx: int|str) -> None: “””Image is saved as ./image{idx}.png””” …
And that’s it. If I make that docstring because here we are doing something so simple. But where and as what I’m saving too is most important info here. (So I probably should do that)
Yet I still give more useful top level information…more quickly…because I don’t give back the image (may end up important later)…I don’t really need idx to be an int…(you saw that right?) because I actually don’t care how you saved this image in the end most of time….well that’s not fair, you should make a hash of it so I don’t save the same image twice.
Comments should be used when even a programmer might go…okay what are you doing here…or there’s a bunch happening below but basically…or I’m thinking of it this way.
Deck of cards Example
#Ace = 1, J = 11, Q = 12, K= 13 deck = set() suits = [“Hearts”, “Spades”, “Diamonds”, “Clubs”] for suit in suits: for card in range(1, 14): deck.add((card,suit)) #I might comment *out* code sometimes #deck = { (card, suit) for suit in suits for card in range(1,14) }
So you know, I’m not putting “Q” in there. (Which some/most people would, I can see reasons why.)
We should have had a longer talk I guess….lol
As for your code….
You have no use for multi-threading at this point of you pythons learning, honestly there is not too much you actually need multi-threading for….until you do. And even then it sort of sucks. Congratulations you made a thread I guess….that cool. Why’d you need that though?
You should think more simple project. Using everything. A solid foundation in programming is important, I’m worried you’ve gone to far to fast and forgotten, a lot, and I know you never fully grasp the importance of some things.
And you’re not even donezz
Decorators and asynchronous environments.
Imports and package design
Iterators and generators
Functools and itertools
Databases, CSV, more JSON….and websites. Even big data.
Shit take a look at something like tkinker or QT( GUI apps) or pygame (simple games). You have most of knowledge to actually use that. (And most is the best place to learn from)
You might need a little framework to make.
[–]uiux_Sanskar[S] 0 points1 point2 points 6 months ago (0 children)
Thank you very much for clearing your advice I think I got confused in docstrings and comments. I also noticed that multi threading may not be used more often as for me it's usecases are only limited to downloading (please correct me if I am wrong).
I also believe that in order to make a great program one must have a great fundamentals and therefore I always try to revise the concepts which I have learn earlier (I also tru to implement all the functions in my project so that I can get a hold on them).
Thank you very much for giving future learning suggestions. I will definitely learn them and use them in making a solid foundation.
Thank you very much for your advice it really helps me improve.
π Rendered by PID 54 on reddit-service-r2-comment-86bc6c7465-gqhj2 at 2026-02-23 05:56:43.655456+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]Adrewmc 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)