• Randelung@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 天前

      A colleague wrote Java style Python. SomethingDispatcher().dispatch() all the way. It’s a mess. Poor guy was thrown into the deep end and left alone for a year. I don’t blame him for the outcome.

      Meanwhile, functools.partial is one of my favorite tools. I wrote a whole SCADA system in which the initialization just builds data pathways using functools.partial so that incoming event callbacks can be handled with all necessary resources already in scope. Any missing data is made apparent at init, not at event time. It’s fast and stable (and I’m pretty proud of it lol).