8 ms·
> But Python is not designed to be fast, and it is not designed to be safe. When decisions made by an algorithm can result in real monetary costs, one must alw
by maxaf 7y ago
> But Python is not designed to be fast, and it is not designed to be safe.
When decisions made by an algorithm can result in real monetary costs, one must always err on the side of caution. Only an irresponsible person would choose Python or other unsafe, dynamically typed language when implementing a crucial piece of business logic.
- ToBeBannedSoon 7y agoPython 3.6+ does have type annotations and multiple static analysis tools for type checking. Only an ignorant or biased person would yell at Python for flaws it doesn't have. For crucial business logic, one also writes unit tests.
- petilon 7y agoUnit tests are not an adequate replacement for compile-time checks performed by a compiler. The former is lax and expensive, the latter is thorough and inexpensive.
- soVeryTired 7y agoLanguage flamewars are silly. Sometimes python is appropriate for production code, weak type system or no. Sometimes it isn't. As a project gets larger, more complex, and more interconnected with other things, static type systems become more useful. End of story, surely? Didn't we all know that already?
- rahulrrixe 7y agoBut you loose so much flexibility. When you start working on a problem, you want your language should give you as little headache as it can with minimum rules and constraints. Then on iteration you can improve like having type annotation, unit tests etc. You can write perfectly fine production level code in Python. It like lego block. Start with simple and then add on. Adding compile type checks comes with its own demerits. I guess here Swift is trying to offer more tool chain on compiler level for model building rather than just being type safe.
- beepy 7y agoFrom the link: > recent versions of Python have added type annotations that optionally allow the programmer to specify the types used in a program. However, Python’s type system is not capable of expressing many types and type relationships, does not do any automated typing, and can not reliably check all types at compile time. Therefore, using types in Python requires a lot of extra code, but falls far short of the level of type safety that other languages can provide.
- woadwarrior01 7y agoI’ve used mypy and pyre on large Python 3.6 codebases and they aren’t even close to type systems in conventional imperative languages (C++, Java, etc) let alone the type systems in the ML family of languages where type system innovations are usually born. I’m sure they’ll get better with time, to an extent. Currently, programmers are forced to pepper the code with lots of ignore annotation comments and redundant union types, just because the type checkers aren’t smart enough.
- petilon 7y agoPython is a fine, accessible language for small programs. ML applications need to be written by data scientists, who are often trained in statistics or math, not software development. For this reason Python is suitable. ML applications built using tensorflow and other ML libs tend to be small -- hundreds of lines, not tens of thousands.
- ilikehurdles 7y agoWhen you start seeing comments like these, you know the whole static typing thing has gone peak cargo cult.
- rimliu 7y agoI am curious what do you think when you see some JavaScript developers moving to Typescript or talks about Ruby 3 having types?
- mr_toad 7y agoTypes errors represent such a small class of errors. It’s just puzzling to see what all the hype is about.
- adamnemecek 7y agoNope, all computation is representable in terms of types. https://en.wikipedia.org/wiki/Curry–Howard_correspondence https://en.wikipedia.org/wiki/Curry–Howard_correspondence
- coldtea 7y agoWhich is neither here nor there, as a contrived case. In actual languages people us e(e.g. that have more than 2% of the job market), type errors caught by the compiler don't catch "all computation" errors. Not even in Haskell...
- sytelus 7y agoIn large sized projects, one of the most frequent activities you do is refactoring. For every refactoring, type errors often constitutes the largest class of errors by volume during initial development phases.
- coldtea 7y agoThen again, a language like Python keeps projects smaller, by not taking 100 lines to do what you can do in 10.