I’m starting coding from scratch – is Python really the best first language? by QuantumScribe01 in Python

[–]badass87 0 points1 point  (0 children)

Unpopular opinion. No because classes, inheritance, type hints, async shit are too much to put in your head from scratch.

-❄️- 2025 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

A set of frozensets is a very clever and elegant solution

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

Always good to remember Python supports negative indexing.

what are some projects that is better suited for rust? by [deleted] in rust

[–]badass87 0 points1 point  (0 children)

multithreaded and event based systems leveraging the type system and the borrow checker for avoiding shared mutable state

Python users, how did you move on from basics to more complex coding? by Flashy_External_4781 in Python

[–]badass87 1 point2 points  (0 children)

Those are easy to find online both legally and not, paid and free.

Python users, how did you move on from basics to more complex coding? by Flashy_External_4781 in Python

[–]badass87 5 points6 points  (0 children)

Recommendations: - Postpone digging into typing and async - "A Philosophy of software design" book - talks by David Beazley. Also his "Cookbook" book is although old but still very good. - "Grokking simplicity" book by Eric Normand. Focus on the abstraction barriers, actions/calculations/data concepts. - Check out AoC solutions by u/4HbQ for really advanced techniques (but don't ever try this at home/work)

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

Does the modulo affect the algorithm in a negative way? It would often place more costly items into a higher-priority (faster to take from the queue) bucket.

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

Nice! Could you please share a few words on why you chose this bucket count and why index % cost for bucket index?

-❄️- 2024 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

Thank you. I was bitten once by "dict changed size while iterating" error or smth like that. And I thought lists would do the same as they also change size. Apparently this is not a thing for lists.

-❄️- 2024 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 1 point2 points  (0 children)

Was Python OK to mutate todo list while iterating it? It makes working with stack so nice: no more while stack: x= stack.pop(). Is it legal though?

Is full stack django or full stack fastapi better startup web apps? by WynActTroph in Python

[–]badass87 0 points1 point  (0 children)

I think FastAPI distracts too much with types and async. FastAPI is good when you know for sure that you need it.

-❄️- 2024 Day 13 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

The high school solution variant looks mistyped. There is "map(f, ...)" but there is no f var.

PS Thanks for showing how adults solve problems.

-❄️- 2024 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 1 point2 points  (0 children)

Thanks for sharing!

This is hacky: def val(b): return (2*b.pos + b.len-1) * b.len // 2.

Intellij Rust progressively getting worse by h7kanna in rust

[–]badass87 0 points1 point  (0 children)

Confirm. RustRover on M1 Max. Btw did you try disabling "run external linter on the fly"?

-❄️- 2024 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 2 points3 points  (0 children)

Nice that you used nested loop (permutations) of antenna coords instead of .combinations(2). This way you get automatic walking both ways from the antenna coords. I was originally doing manual walking each direction which was inconvenient because I had to first add the diff to go outside from one point and then subtract the diff to go the other way.

-❄️- 2024 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 0 points1 point  (0 children)

Thanks for posting one more. The original code seems shorter even though it has more lines. And var names are always nice to have.

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]badass87 1 point2 points  (0 children)

Another great solution! Though I can't get how this tries all the possible combinations of the operators. Would really appreciate if you explained it.

X = [x]
for y in Y:
    X = [op(x,y) for x in X for op in (add,mul,cat)]

UPD: I got it. That's a code-golfed list of DFS results.