• 1 Post
  • 182 Comments
Joined 1 year ago
cake
Cake day: July 2nd, 2023

help-circle
  • affiliate@lemmy.worldto196@lemmy.blahaj.zoneRule
    link
    fedilink
    arrow-up
    23
    arrow-down
    1
    ·
    5 days ago

    a wise programmer knows to always ask the question “can i solve this problem in python using metaprogramming?” in this instance, the answer is yes:

    def is_even(n: int):
        s = "def is_even_helper(number: int):\n"
        b = True
        for i in range(0, abs(n)+2):
            s += f"\tif (abs(number) == {i}): return {b}\n"
            b = not b
        exec(s)
        return locals().get("is_even_helper")(n)
    













  • the whole “there are two sides to every issue” mantra that i hear so many people use in everyday life has got to be contributing to this. i think a lot of people view the “two sides thing” as a tautology, and that enables them to more easily “pick a side” on things, assuming that both sides always have some merit to them. and some people use it to avoid picking sides entirely, because if they make something seem complicated enough then they don’t have to actually say anything meaningful about it.

    i would really like to see that mantra disappear altogether, or at the very least have people stop using it as an excuse for not having a well founded opinion. it does seem like people don’t let it slide very much on lemmy though, which is nice.


  • i gave up on gentoo when the updates started making my laptop so hot that i had to point my bedroom fan at it in college. i was thinking of doing LFS but by that point gentoo was turning into such a headache and i wanted something simpler. i switched to arch afterwards, but now i mainly just use macos and let tim handle all that stuff for me. although i’m tempted to try arch again when im done with grad school and have more time