Earlier quoted context omitted.
It's language vs libraries. If you have a library that has a function get_the_shit_done_quick () than you don't care much about the language. When you don't have such function, you need an expressive language to write it (and a bulk of python libs are not written in python, tho mostly for the performance reasons). So it's all about finding a sweet spot between fancy libraries which do the shit for you, and fancy lang…
Language vs libraries isn't just about an expressive language to build in when you don't have a library. The likelihood of a library's availability also depends on the barrier to entry. An amazing language that isn't usable by biologists won't have many libraries that solve biologist's problems. To your original point of being "surprised at how many data scientists and quants are ignoring more mathematically principl…
Python Is Eating the World
861–870 of 993 posts
Re: Python Is Eating the World
#862Earlier quoted context omitted.
FYI, the google style guide (or maybe the internal only version) suggests to avoid initialize-then-assign in favor of single assignment form: unclear_type_thing = ... if isinstance(unclear_type_thing, list): group_keys = unclear_type_thing else: group_keys = [unclear_type_thing] statically avoids this problem. In general, prefer immutable variables where possible. Single-assignment form is nice for a lot of reasons,…
All of these things are true, but they require a non-trivial level of experience and discipline to avoid most potential gotchas. Your average Python project on the Web isn't written to this level of quality, and when people are learning programming using Python in school they certainly aren't there yet, and are gonna hit all kinds of problems related to this stuff. But is there a way to force immutable variables in P…
Not always. Mypy has experimental support for `Final[T]` [0], and attrs/dataclasses support final/frozen instances, but that's opt in on a per-argument basis.
Re: Python Is Eating the World
#863Earlier quoted context omitted.
>If there's one thing wrong with our profession is a lack of ethics and accreditation - we're essentially letting random people build critical infrastructure and utilities. https://ncees.org/ncees-discontinuing-pe-software-engineerin... There was a license for a professional software engineer; they're discontinuing it, apparently due to lack of demand. If folks wanted to get a "software people taking the FE" study gr…
As someone with a P.E. license that spent hundreds of hours studying and had to sit for that excruciating 8-hour exam twice, I don't think even 5% of the software developers in the US could pass an equivalent exam. Granted, I think the sector I took it in has a harder test than some, but it is a weed out test for someone that already took 4 years of Engineering school. Some takeaways from this: 1.) I learned a little…
I personally find tests to be way easier than school, and the schools with reputations that are worth something are... pretty difficult for people like me (who weren't on the college track in high school) to get into. (and there is something of an inverse correlation between the prestige of a school and how flexible they are about scheduling around work; especially for undergrad)
From what I've seen of the test, it does provide some foundational ideas of what engineering is about. Like, it goes a lot into figuring out when things will break - something I haven't really seen a lot of in software engineering.
What I'm saying here is that I dunno that an optimal SWE PE would test you very much on the specifics of Java or SQL or what have you. I mean, from my experience with the FE, at least, they give you a book that has most of the formulae you need... and you are allowed to use a copy of that book during the test, you just need to be able to look it up and apply it. Seems like they would do the same with Java or SQL.
(I mean, to be clear, to apply the formulae, you still need to have more math than I do. I imagine the same would be true of sql or java, only I'm pretty good with SQL, having 20 years of propping up garbage written by engineers who weren't.)
From what I've seen of the software engineers, Most of the time, the software guys throw something together, toss it over the fence and move on. Clearly, they didn't do any analysis to figure out how much load the weak point in the system can handle, or even what the weak-point was. It's incumbent upon me (the SysAdmin; usually the least educated person in the room) to feed load to it at a reasonable speed and to back off and figure out what happened when the thing falls over.
I mean, I think the real question people are bringing up here is "what if we treated software engineering, or at least some subset of software engineering more like real engineering?" - like clearly sometimes you can slap together something over the weekend and it's fine, but... if you are building a car or an airplane or a tall building or something, you probably want to put in the time to make sure it's done right, and for that, you need rules that everyone knows; the PE system, I think, establishes rules everyone knows, while I think software engineering mostly works on the concept of "it worked for me"
Re: Python Is Eating the World
#864Earlier quoted context omitted.
I believe that marketing Python as "strongly typed" has the potential to confuse rather than educate. Python still crashes at runtime with these errors. It has nice error messages, but it still crashes, potentially in production. If you want to create your own "types", you'll have to add your own runtime checks. It's much more sane than JavaScript, but it's not strongly typed like Haskell. Python does not automatical…
You are describing static typing. There is a well defined difference between strongly typed and statically typed.
Re: Python Is Eating the World
#865Earlier quoted context omitted.
My criticism is mostly aimed at the language (and its standard library) itself. The major projects I worked on, I architected from the beginning. It is when designing and architecting reliable systems that Python's terrible nature hits you in the face, especially if you're used to better languages. Take the nonsensical but alluring Python motto "There should be one -- and preferably only one -- obvious way to do it."…
Don't get me wrong, it is obviously your right to dislike a language. I've designed plenty of reliable systems in Python without much issues whatsoever with making them reliable. I have had some problems with code organization over the years (Python certainly lets you "do your own thing" which can lead to issues with organization over time) however I haven't had reliability, stability, or speed issues for 95% of the…
Python GIL takes away lots of viable solutions.
Lack of metaprogramming / code generation at runtime.
Lack of performance forcing me to severely compromise or implement things in C.
Type system is probably among the worst in the dynamic language space (compare to Common Lisp and Erlang).
Python is not an interactive programming language and can not be used to implement rapid feedback loops as is possible in Common Lisp, Smalltalk and Erlang.
The object system is very basic and error-prone compared to CLOS.
The error handling system is very limited.
I've found that all of these points translate into loss of flexibility and severely constrain the solution space. Having worked extensively in all of the alternative languages that I mentioned, there is not a single day that goes by where I'm programming in Python that I don't curse the language for being so limited / badly designed.
Re: Python Is Eating the World
#866Re: Python Is Eating the World
#867Earlier quoted context omitted.
Both static type systems and unit testing are just tools which are supposed to help programmers to deliver higher quality software. Both static type systems and unit testing have their disadvantages. For static type systems, you sometimes need to bend backward to make it accept your code and it's not very useful before the code grows large enough. For unit tests, even if you have 100% test coverage, it doesn't mean t…
> For static type systems, you sometimes need to bend backward > to make it accept your code and it's not very useful before > the code grows large enough. How large need a program to become, before the advantage of being allowed to write fishy code is counter-balanced by the types becoming untractable and the code impossible to refactor in any meaningful way? This is a serious question. Some years ago, apparently Gu…
I think it's better to measure the number of separate code entities (classes and functions and modules in Python) and how many different use-cases (ways of calling functions and object constructors) each entity is expected to cover... After converting to LOC, I'd say ~500 would be the limit. After that, it's a constant fight with TypeErrors, NameErrors, and AttributeErrors - it's just that everyone is already used to this, while not many know of any alternatives. Also, there are substantial differences between languages - in some 10 lines are enough to start complaining, while in some others I've seen and worked with ~2k loc code and it was manageable.
> many powerful compiled languages have appeared thanks to PL research, that are almost as expressive as script languages.
Yes, but on the other hand, some powerful static type systems for dynamic languages also appeared, and some of them are close to Haskell in terms of expressivity. The particular example here would be Typed Racket, which has a state of the art type system which is built on top of untyped Racket. It supports incrementally moving your untyped code to the typed one (whether a module is statically or dynamically typed is decided when module is created; as you can define many (sub)modules in a single file, you can just create a typed submodule, re-export everything that's inside, and move your code there one procedure at a time). Also, it automatically adds contracts based on static types, so that they still provide some guarantees when a typed function is imported and used in untyped code. There are many interesting papers on this, and TypedRacked is really worth looking into, if you have nothing against Lisps.
> Compile time type checking does not contradict testing, like you made it sound somewhat in your message.
Damn! I actually wanted to argue exactly this: that both tools are useful and both can be used together to cover their respective weaknesses. :) Looks like I need to work harder on my writing skills...
> I'm sorry if all this sounds condescending. I am yet to decide whether I should allow myself to sound condescending as the only benefit of age :)
Well, it didn't sound condescending to me, so no prob :) But, if you'd like an advice on this: please don't try to be condescending on the basis of age alone! It's totally ok to sound condescending if you have knowledge, experience and skill to back it up... Well, at least in my book :)
Re: Python Is Eating the World
#868Earlier quoted context omitted.
Serious question: If you are writting unit tests to check types, why not just use a language that has a compiler that does that for you? And if you are writing python with type hints, why not just use a language that uses the types you spend time adding to make your program faster. Python is great for sharing ideas / concepts, but under some circumstances it seems irresponsible to choose it over other viable options…
As the sibling comment said, I'm not proposing checking types in unit tests, I'm proposing checking that the behaviour is correct. If there's a code path that passes in a bare string instead of a list, and your logic breaks, then that code path should have a failing test case. However, type hints can provide another opportunity to catch this kind of mismatch before they even get committed. > under some circumstances…
Re: Python Is Eating the World
#869Earlier quoted context omitted.
> a non-trivial burden to configure and learn any new tool chain. It's hard to take complaints like this seriously.
It's even harder to take "The IDE should make up for deficiencies in the language" seriously. In languages that handle this stuff well, you can edit in Notepad and still not make these mistakes. Why push it up several levels to a few specific IDEs that most people don't even use?
Because those IDEs those solve problems, so that you can close tickets on the project at hand, without having to port it to the best language evar.
Re: Python Is Eating the World
#870Earlier quoted context omitted.
> There's no way in an import statement to say which one you want. This would be fixable with a sys path hook, were pip so inclined
It would change the semantics of the language. You could also write a sys.path hook to interpret the remainder of the file as Ruby and not Python, were pip so inclined.... (Also it's not clear what those changed semantics would be.)
> remainder of the file as Ruby and not Python
That's a little excessive