• 0 Posts
  • 38 Comments
Joined 10 months ago
cake
Cake day: August 21st, 2024

help-circle


  • i think we’re talking about different things. you use enforce to mean “validate”, i used it to mean “coerce”. one of the cases was a command line argument parser that consisted of a single decorator, so you could write

    
    @command
    def foo(bar: int, baz: float):
        print(baz * 2 + bar * 3)
    

    and call it with $ myfile.py foo --bar 3 --baz 2.2 and it would print 13.4

    another was about creating working protocol buffers from an excel sheet, nested types and enums and oneofs and everything. we used it to parameterize tests of our bluetooth protocol.



  • the problem is that the language doesn’t and can’t support one single way to use type annotations without changing fundamental functionality. you can absolutely hook up mypy to your editor for newbies, but once you get on the intermediate level, fighting with mypy takes more code than actually solving the problem.

    also there was that proposed update to mypy that was put on held when it turned out that the maintainers didn’t know how annotations are used in the wild.








  • none of these are race conditions, they’re just runtime errors. python only parses code when it is about to run that block so you can absolutely get a crash from bad indentation.

    in my experience, the js world’s focus on developer ergonomics has absolutely yielded some insane situations where running an installed script has caused it to start downloading more dependencies. however, this has unfortunately started happening in python too lately.