5 ms·
what is this strange obsession with type , it improves performance yeah sure . but to go around claiming that it is a panacea for all things poorly planned is p
by elisharobinson 7y ago
what is this strange obsession with type , it improves performance yeah sure . but to go around claiming that it is a panacea for all things poorly planned is pure unadulterated stupidity. i can concede that some immutable data structures are needed , but types not for me .
Python doesnt handle threads well this can be true. also if you are straining python threading system you ought to take a look at your own abstractions and design. chances are you wont go very far before you hit the same bottle neck in a different language if you assumed python gave up at X you could achive 100X with go but you will almost certainly hit the same issue when your data grows 100X.( i am aware of computational complexity is a factor. but the author claims that part is handled in C , from what is described it looks like they replaced flask with go)
- wyldfire 7y ago> what is this strange obsession with type , it improves performance yeah sure Static typing allows for a lot of static decisions which in general brings better performance for a language. CPython pushes so many decisions to runtime that it is a very significant performance impact. But the article cites more significant challenges related to type. Not performance, but design: > "First, Python uses loose typing, which was great for a small team rapidly developing new ideas and putting them into production –but less great for an enterprise-scale application that some customers were paying millions of dollars for," he writes. Cue the reminder that in fact Python is strongly (but dynamically) typed. But LeStum's point stands: dynamic type hurts developers trying to read/write unfamiliar python code. The mypy static typing should help out a lot but I don't think it's very popular yet. For performance, IMO in this order you should consider (1) PyPy, (2) multiprocessing, (3) cython and/or c-extensions. (and I suppose implicitly (0) analyze your algorithm, exploit numpy where possible). If you exhaust those, Go seems like a great alternative.
- elisharobinson 7y agoi agree . i might clarify my original post, im half asleep. but i agree with the correction you pointed out in my original post.
- fiedzia 7y ago> For performance, IMO in this order you should consider (1) PyPy, (2) multiprocessing, (3) cython and/or c-extensions They are all very limited in what they can do (neither can replace others) and bring tons of complications. Modern languages can give you all of that without big issues.
- nightski 7y agoA good type system is like a set of unit tests that are written for free and checked automatically every time the software is built. The better type systems feel natural and do not create extra work. Actually, having worked with some great type systems in my life (especially in the ML family of languages) I feel they can assist with design and thinking through a problem by explicitly stating your intentions without being tedious. Obviously type systems like C++/Java do not fit this bill. But lastly, they are even more useful in my experience when dealing with other people's code. Types can be self documenting to an extent and provide certain guarantees (or lack of guarantees) about the code itself. Of course how much information the type system conveys varies wildly based on the power of the type system (Haskell vs. C++) and the desire of the original developer to communicate intent through types.
- elisharobinson 7y agothe problem i have with premature type or type obsession is , you commit to a data model without even completely understanding the business model / rules there is this myth that you understand the requirements clearly and that it wont change quickly or by a lot . Python gives me the flexibility to whip up a service and check if fits if it doesnt fit throw it and try again, i wouldnt need to start from scratch , i can do well be removing dead or unwanted code and some basic cleanup to have a good start point. I cant comment on ML family cause i have not used it in prod env.
- hota_mazi 7y agoThat commitment is very light and easily adjusted, though. Once you have types in your source code, automatic refactorings are not just blazingly fast, they are also safe. These days, dynamically typed languages have realistically zero advantages over a modern statically typed language.
- elisharobinson 7y ago"light and easily adjusted" is it though. maybe when you use haskell and functional languages which might not have strong dependency . if i am being honest i cant extract the precise requirement on the first iteration it is only as more feature request come as iterations progress with "small additions" only then do i find the real requirement. from my exp with java/c++ your data model is sacrosanct it cannot be touched especially if you have untraceable down stream dependencies.
- jumpingmice 7y agoTypes improve productivity in large legacy projects. When I have to review a change in python I have to check absolutely everything from scratch. I have to look at the signatures of the called functions to see if the call sites are correct, where a typed and compiled language would simply fail to build. And I have to carefully check every block to see if attributes of none-typed variables are being accessed. Python is a bit like a high-interest credit cards for coders. You can use it to make it look like you just whipped out a huge project from scratch. But you will spend the following decade paying down the tech debt.
- elisharobinson 7y agopython has a awesome type system , even though it has support for dynamic typing. you cant use dict, int, list interchangeably given enough time you notice operations and methods which can only work for a given type. but when the types share similarity like they are iterate-able they work predictably. although its not for everyone , but if your talking about large projects you could use metaclasses to enforce type checking during instantiation. tech debt can sometimes be unavoidable. i often find the case to be that a project stops progressing due to fear of breaking something and not knowing how to fix it. In python this fear is reduced almost by an order of magnitude compared to other programming languages. also in typed languages used in large projects. the project itself behaves like a standard or a protocol , people memorize the values of bytes each request contains , people start maintaining informal codes to access the project or it becomes some hob goblin of word documents , pdf and jira . and god forbid you need to make a change in the datamodel to a more optimized model, you would most likely have to throw away most of your code which you wont do because solving all the build issues and waiting for it to compile from start doesn't go on the clock as time spent coding something useful.
- jumpingmice 7y agoIt would be helpful if you could mention your employer so I don't accidentally go work in such a place.
- 7y ago
- cle 7y ago> but to go around claiming that it is a panacea for all things poorly planned is pure unadulterated stupidity. The article never claimed this: > "First, Python uses loose typing, which was great for a small team rapidly developing new ideas and putting them into production –but less great for an enterprise-scale application that some customers were paying millions of dollars for," he writes. There are tradeoffs with both static and dynamic typing. Know the tradeoffs, know your business, then make the right decision for your use cases.
- elisharobinson 7y agoi assumed that the implication was type checking the project was able to help them scale the team. which makes absolutely no sense whatsoever.