News for hackers. Stuff that matters.
Re:Flask 1.0 Released by mixmastamyk on Friday April 27, 2018 @11:34AM (#16941551)
True in a very large project, false on the rest. Congrats on your one-true-way argument. ;)
Re:Flask 1.0 Released by weberc2 on Friday April 27, 2018 @12:36PM (#16942124)
I'm a professional Python dev, I have no reason to believe that decorators save any time for any size of project. They're harder to reason about for developers of all experience levels and their is no obvious advantage--some argue that the syntax is more pleasant, but I don't perceive an increase in readability; certainly not one that makes up for the increased cognitive burden. The following is super straightforward, testable, and it doesn't depend on globals for shared resources or request state:

    def hello_handler(r: Request) -> Response:
        return Response.ok("Hello!")

    def goodbye_handler(r: Request) -> Response:
        return Response.ok("Goodbye!")

    if __name__ == "__main__":
        router = Router("/")
        router.register_route("/hello/", "GET", hello_handler)
        router.register_route("/goodbye/", "GET", goodbye_handler)
Re:Flask 1.0 Released by mixmastamyk on Friday April 27, 2018 @03:03PM (#16943367)
I was thinking more of the fact the are paired with the view. To be honest never gave the fact they are decorators much thought.