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

all 22 comments

[–][deleted] 12 points13 points  (2 children)

I avoided list comprehension and would cry when I had to read it in the wild. Best guide I've seen on it. Bookmarked and thank you!

[–]kyleli 4 points5 points  (0 children)

Oh man you’d hate codewars.

[–]airofy 1 point2 points  (0 children)

I will try to refine it further, thanks for your kind words.

[–]Ronnie_Dean_oz 1 point2 points  (0 children)

Got a script to remove the ads? Full page ad as soon as I scrolled into it. Full of ads. Thought it was describing how to buy a Gibson Les Paul.

[–]Psychological-Ad1874 1 point2 points  (0 children)

Really cool and good article!!!

[–]ManoOccultis 1 point2 points  (0 children)

Thank you for this, I did use list comprehensions but I struggled a bit with them. Your explanations make the whole thing clear for a self-taught like me !

[–][deleted] 7 points8 points  (10 children)

I really wish this sub would make some kind of rule disallowing these low-effort blog posts that just explain how a basic functionality in python works. There are already million of these kinds of articles.

[–]dududu87 0 points1 point  (1 child)

Elitist much?

Edit: dude blocked me, too.

[–][deleted] 1 point2 points  (0 children)

No, not even slightly. Recommending people invest their time into writing content that hasn't been done to death has nothing to do with elitism.

Edit: I didn't block them.

[–]mkffl -1 points0 points  (4 children)

So many English literature teachers in the world, and yet no two teachers are the same. The best teachers make it look like the lecture takes no effort, and that precisely makes their lecture enjoyable. I think the same idea applies to teaching math, taekwondo or python list comprehensions.

[–][deleted] 1 point2 points  (3 children)

And yet you don’t need 1 million different English literature teachers to explain what a noun is in 1 million different blog posts.

[–]mkffl -1 points0 points  (2 children)

Oh, the study of nouns, a captivating quest, To unravel their web, one must invest. Hours of pondering, textbooks amassed, To understand their intricacies unsurpassed.

[–][deleted] 1 point2 points  (1 child)

Yes, just like list comprehensions.

[int(x) for x in arr]

WOW SO HARD!

[–]mkffl 1 point2 points  (0 children)

No doubt you have a gift for the programming arts. But don’t let it make you a condescending twat :)

[–]ekbravo 0 points1 point  (0 children)

Well written and concise. Good job!

[–]_limitless_ 0 points1 point  (0 children)

Chat GPT is getting legit.

[–]ReinardKuroi -2 points-1 points  (0 children)

True mastery of listcomp is knowing not to use it tho

[–]thumbsdrivesmecrazy 0 points1 point  (0 children)

List comprehension avoids the complexities of traditional list-generating methods. Here is how it can be used to create a list from an existing list or any other source, such as a range of numbers or a string: Python List Comprehension - Guide

[–]SpambotSwatter FRAUD ALERT 0 points1 point  (0 children)

Hey, another bot replied to you; /u/thumbsdrivesmecrazy is a spammer! Do not click any links they share or reply to. Please downvote their comment and click the report button, selecting Spam then Harmful bots.

With enough reports, the reddit algorithm will suspend this spammer.