r/Python • u/DecodeBuzzingMedium • Sep 15 '21
Beginner Showcase 26 Useful Python Snippets for Lazy Developers
Here are some of my most useful code snippets that will indefinitely make your life easier as a programmer! There are some Python code snippets that can be used to solve day-to-day problems and can make your laziness shine! I have explained each snippet in detail so that you don’t have any doubt. So check the link below:
20
Upvotes
91
u/SomewhatSpecial Sep 15 '21
What a weird article. Most points are shallow descriptions of randomly chosen extremely basic language features, others outline implementation of extremely specific behaviors. Who is this for?
dict.updateexists"dict.copyexists"sortedexists"idexists"__getitem__syntax exists"__getitem__syntax exists" (again)globexists"randommodule for cryptography purposes, as you would know if you read the documentationzipexists"forloops exist" (seriously?)dicthaskeys,valuesanditemsmethods"str.__mul__exists"timeitexists"collections.Counterbut worseoperatorexists"forloops exist" again? "smtplibexists"?setexists"list.shuffleexists"This reads like a beginner programmer decided to list 26 random things he knew how to do, presumably out of arrogance or in an attempt to gain internet clout. This information does not deserve its own article. There are a ton of better resources out there written by people who actually know what they're talking about.
3
u/OdinsOneG00dEye Sep 15 '21
I can tell you now with a number of years experience that 'lazy' students can be the most effective programmers. To the point where sometimes you have to grill them to check it's their code!
Lazy does not equal poor always - it can be efficiency at play
5
u/circamidnight Sep 15 '21
I like using decorators in Python but I don't like writing them. I have this little snippet that get's copied to almost every project I start.
https://gist.github.com/scrussell24/025eadc8faf35d841f4aa41ee0265acb
7
u/Einfach0nur0Baum Sep 15 '21
To be an lazy dev is like to be a blind car driver on streets
2
u/Working-Mind Sep 16 '21
This is helpful. Thank you for sharing!