Login
You're viewing the ruby.social public feed.
  • Nov 1, 2026, 6:48 PM

    I have to admit that I would never have thought of option 3 and the place I saw it was code that was probably generated by an LLM. But it has its merits... the fallback is clearly an argument to a function.
    I love if-else assignments but they are rarely as short as in this example and then they become unreadable.
    Maybe there's an even better solution that I'm not aware of? Better as in pythonic or elegant. I'm not so much concerned about speed.

    💬 0🔄 0⭐ 0