Earlier quoted context omitted.
Wasn't worth taking the time to figure out, since none of us were expert level in python and we only needed a one-off profiling tool. I rewrote it in Julia, which killed the problem.
So you have no idea what it was but you’re certain it’s Python’s fault?!
All the things I hate about Python
71–80 of 87 posts
Re: All the things I hate about Python
#72> However, Python does not have a real privacy model. > This is unsettling if you’re coming from a Java or C/C++ world and are expecting access modifiers It's unsettling to a lot of people, but so what? I still don't see a solid use case for where member access (not "privacy") is a good idea. Python is one of the only languages to get access modifiers right (convention), imo and I don't even like Python. You could im…
Re: All the things I hate about Python
#73My main beef with python is its packaging management. It's a clusterfuck of half-baked, non-standard, spaghetti code approaches. The Zen of Python says "There should be one-- and preferably only one --obvious way to do it." Python package management makes that in to a joke.
That's because package management is an extremely hard thing to do if you're only trying to control one part of a system and have it work magically in different environments. And so strangely enough programming language people writing their own toy-town package managers get it wrong again and again and again.
Re: All the things I hate about Python
#74But seriously, the points raised by the author are valid. However despite this Python is still a pleasure to use. In addition the author fails to mention some newer things, which can help with some of the problems Python has:
1. Python Type annotations https://docs.python.org/3/library/typing.html
2. Please use the concurrent futures package for multithreading: https://docs.python.org/3/library/concurrent.futures.html
3. For distributed concurrency please use Dask: https://dask.pydata.org/
4. Please use pipenv for package management: https://docs.pipenv.org/
5. For performance, have you tried numba: https://devblogs.nvidia.com/seven-things-numba/
Re: All the things I hate about Python
#75So being a professional Python/Django coder, I was aware of all these issues. And yet, those issues do not seem to stop the Python train from moving forward.
A couple of issues to note in his article: Everything he says is true, but the conclusions are mostly false.
1. Optimizing databases and data access are the number one scalability issue. It's the hardest thing going from a monolith to a microservice architecture. Goroutines, threads, etc. don't solve that for you.
2. Threads are terrible in any language (except Erlang maybe), and reliable code cannot be used with primitive thread constructs. Goroutines are good enough, sure. Also python asyncio. But not threads. I've seen production systems that no one could debug, because 3000 threads ran amok, thread deadlocks, race conditions, etc. And you can't unit test threaded code effectively either.
3. All software has multiple build systems. C/C++ and autotools, CMake, Scons, Waf. Java and Ant or Maven or Gradle or whatever. Go is sane for the most part, until you get to dependency management -- goglide, govendor, etc.
4. Strongly typed, statically typed systems (Java, C++) usually aren't. Usually people rely upon that as a crutch to think they don't have to worry about types, until they see NullPointerExceptions (java) or segfault (C/C++) in production.
5. Python code is only as reliable as the person who wrote it. But that's true of C/Java/C++ etc. People have to understand where the pitfalls of a language are, and that's usually documented in coding standards or style guides.
Re: All the things I hate about Python
#76Totally agree with this person's assessment on types. I took over a smallish half-completed web application written in python a couple of years ago. Nothing major - simple business-y analytics/data viewing app with some fancy charts and tables etc - perhaps a couple of thousand lines of code interfacing to backend database unique to our business. It had some tests, but nowhere near 100% coverage. I needed to finish i…
I have seen python code written this way. It's not a joy to work on. This function returns this type of class or this other type of class based upon input, and the two are not interchangeable say, so you have to refactor a bunch of code if your type changes underneath you.
The typical pattern is a method should return something of one kind of class only or raise an exception. And then newer tools like PyCharm can help you out here by knowing what the functions are going to return.
Re: All the things I hate about Python
#77I am surprised nobody mentioned python's weird scoping rules for local variables. It bit me countless times.
def myfunc():
try:
while x in someiterator():
a = x
dosomethingwith(a)
except:
# Does a exist here or not?
If someiterator() raises then a won't exist in the function block. Otherwise it will.Re: All the things I hate about Python
#78Earlier quoted context omitted.
"Ubiquitous" is spelled correctly. Why the "[sic]"?
> "Ubiquitous" is spelled correctly. Why the "[sic]"? For what it's worth, '[sic]' doesn't necessarily mean "that was spelled incorrectly", only, literally, "thus": i.e., "that's the way it was in the original; don't blame me." As such, it can be used to indicate misspellings or 'misconceptualisations' ("I know that it's the wrong word, but it's the one that was there"), as nmyk ( https://news.ycombinator.com/item?id…
Re: All the things I hate about Python
#79Hi everyone, so I'm the guy who wrote this article. I'm sharing a video recording of George Hotz writing some Python code. Note his reaction at 5:55 https://www.youtube.com/watch?v=7Hlb8YX2-W8&t=355s His outburst is an emotional manifestation of the different sources of frustration I've had working with Python that I've tried to document. A common theme I've seen in responses is that many claim that I've mistaken Pyt…
Regardless of language, x -> a + 1 is not going to work if a never has a value. In many cases handling “a doesn’t have a value” is the wrong way to address the problem, because the problem should be solved as “figure out why the data collection didn’t work, and propose a strategy for handling our dataset when either a value is missing or is provably wrong.”
As an example one might assume that a video feed has exactly as many frames per second as it says on the tin (eg: 24fps will have exactly 24 frames for each second of video) but in reality there will be missing frames due to data corruption, or even a mismatch in clock speeds meaning that over 100 seconds you have 2398 frames instead of 2400. How do you handle the missing two frames? The problem is there are no frames missing, it’s just that they were never there to start with, and frame 1237 of another source has no direct equivalent in the slightly-faster stream. You might alter the clock for processing, duplicate one or two frames, use interpolated frames, or otherwise process the various sources so that you get a consistent synthesised data stream with which to do further processing.
Strong typing doesn’t help solve real problems.
Re: All the things I hate about Python
#80> there is no question that type safety matters for building and maintaining large-scale distributed systems in the enterprise. Some of the largest-scale enterprise distributed systems, as in, at the telecoms level, are written in erlang, which is dynamically typed, and highly reliable.