But one compiling error is Java is 7 run time errors in python.
There is a type error and you couldn’t have known it beforehand? Thanks for nothing
I will confess that I get a sense of psychological comfort from strict typing, even though everyone agrees Python is faster for a quick hack. I usually go with Haskell for quick stuff.
I find Python is quick for the first 30 minutes. If you need any kind of libraries, or assistance from an IDE, or a distribution build, or you’re more familiar with another language, then it isn’t quicker.
If you need any kind of libraries
PyPI has a huge selection of libraries
assistance from an IDE
PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm’s functionality, lots of other IDEs have decent python support
or a distribution build
Not sure exactly what you mean by this
or you’re more familiar with another language
Yeah this can be said about any language. “You’re quickest in the language you’re most familiar with”. That’s basically a tautology.
Oh boy, you really wanna talk about it?
PyPI has a huge selection of libraries
It does, but the lack of static typing means it is more difficult to interact with foreign code (correctly).
When I pull in a library in a JVM language or Rust etc., I quickly glance at the documentation to get a rough idea of the entrypoint for the library.
Like, let’s say I want to create a .tar file, then the short “Writing an archive” example tells me all I need to know to get started: https://crates.io/crates/tarIf I need to find out more, like how to add a directory, then having the tar
Builder
initialized is enough for me to just ask my code completion. It will tell me the other available functions + their documentation + what parameters they accept.
If I make a mistake, the compiler will immediately tell me.In Python, my experience was completely different. Pulling in a library often meant genuinely reading through its documentation to figure out how to call it, because the auto-completion was always unreliable at best.
Some libraries’ functions wouldn’t even tell you what types you’re allowed to feed into them, nor what type they return, and not even even diving into their code would help, because they just never had to actually specify it.PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm’s functionality, lots of other IDEs have decent python support
Yes, PyCharm is a super powerful IDE when compared to Nodepad++. But it’s a trashcan fire compared to IntelliJ or even the much younger RustRover.
Half the time it can’t assist you, because no one knows what types your code even has at that point.
The other half of the time, it can’t assist you, because, for whatever reason, the Python interpreter configured in it can’t resolve the imports.
And the third half of the time, it can’t assist you, because of what I already mentioned above, that the libraries you use just don’t specify types.These are problems I’ve encountered when working on a larger project with multiple sub-components. It cost us so much time and eventually seemed to just be impossible to fix, so I ended up coding in a plain text editor, because at least that wouldn’t constantly color everything red despite there being no errors.
These problems are lessened for smaller projects, but in that case, you also don’t need assistance from an IDE.
or a distribution build
Not sure exactly what you mean by this
What I mean by that is that Python tooling is terrible. There’s five different ways to do everything, which you have to decide between, and in the end, they all have weird limitations (which is probably why four others exist).
or you’re more familiar with another language
Yeah this can be said about any language. “You’re quickest in the language you’re most familiar with”. That’s basically a tautology.
Yes. That is all I wanted to say by that. People just often claim that Python is a great prototyping language, to the point where the guy I was responding to, felt they’re doing the wrong thing by using the familiar tool instead. I’m telling them, they’re not.
Look, it’s fine if you prefer other languages to python, I won’t besmirch anyone’s preferences. But literally everything in your post exists in nearly every programming language (minus some of the typing stuff, I’ll give you that, but it’s getting a lot better). Like, every language has some learning curve to setting up tooling, or configuring your IDE the way you like it, or learning how to navigate documentation so that it’s useful, or trying to decide on one of the multiple ways of doing things. I guarantee, as someone with limited experience with Java, I’d have a difficult time setting up and using IntelliJ, and figuring out which build/packaging system I need to use, and figuring out how to use whatever libraries I need, simply because I’m unfamiliar with the ecosystem. That’s all you’re describing - the initial learning curve in getting familiar with a new language. Which is why I pointed out all the things I pointed out. It’s where I start when I’m introducing developers to python.
And then the quick hack gets a permanent solution and the next employee has to fight trough the spagetti.
sounds like not my problem
You will find yourself being that next person when you haven’t touched the code for a week and come back to add something and are like wtf.
The circle of 1!f€
With type annotations, this problem is mostly alleviated in practice, while still keeping the productivity gains of duck typing.
In my experience, Python’s type annotations are annoying as hell, because there’s no inference.
The IDE can assist you before it even becomes a problem, so even more time saved.
Did everyone become stupid in the last 10 or so years? We used to write huge apps in Python without any type checkers or static analysis tools and never had any problems we wouldn’t have had in statically typed languages.
I find it’s possible to operate Python as a statically typed language if you wanted, though it takes some setup with external tooling. It wasn’t hard, but had to set up pyright, editor integration, configuration to type check strictly and along with tests, and CI.
I even find the type system to be far more powerful than how I remembered Java’s to be (though I’m not familiar with the newest Java versions).
This little hack is gonna cost us 51 CPU cycles.
Yeah but due to the extra indentation in the second image, the python party doesn’t work.
I don’t understand why people complain about their Python code breaking because it relies on indentation instead of explicit {} syntax. I’ve never had an issue with it and it’s not just because I’m used to it because Python is the only language I use that relies on whitespace like that. I think the complainers just don’t know how to indent properly, which makes me really glad they’re writing in a language that forces them to instead of pushing unreadable garbage in other languages.
deleted by creator
I mainly found it annoying while writing code, because the lack of braces makes it difficult to tell when a scope ends. Plenty times, I’ve wanted to add something to the end of a for-loop, but had too little indentation.
Usually this means I get a runtime error, because it can’t access some variable from the loop-scope. But worst case, it only executes once after the loop and I don’t notice the problem.Another big thing I miss when not having explicit braces, is opening up new/anonymous scopes to isolate variables, which helps prevent mistakes down the line + reduces code complexity.
For example, this is a thing I do quite regularly:
let client = { let client = new Client() let timeout = config.load("client.timeout") client.set_timeout(timeout) client //implicit return value of this scope when evaluated as an expression } client.request_something()
It allows me to visually group the initialization code for the client and I don’t need to have the
timeout
variable in scope afterwards. Depending on the language, you can also have theclient
variable mutable inside the scope and then immutable outside.Yes, this could be pulled out as a function to achieve something similar, but in my experience people (including me) will often just not do that, because it’s only the
timeout
variable or whatever.Try finding a bug related to indentation in a 15 year old python codebase by the worst programmers on the planet. You won’t think that there’s no issues with it after that point. In any other language you literally just reformat and you’ll see the bug. That’s not the case in Python.
its just not as clear especially when u are indenting stuff inside stuff with a bunch of conditions everywhere its hard to read just from indentation, and with the () or {} u can just click on it and most text editors will show u from where to where its going.
And
++++++++ [>++++++++++++>+++++++++++++<<-] >++++. -. >+++++++. <+. +.
in brainfuck
Thanks, I hate it
And about 20 in perl. But the return trip is 300 years
Java feels like McDonald’s and python feels like a grocery store.
Rust feels like a femboi hooters where they offer IVs you don’t think they’re qualified to administer.
I don’t understand any of these analogies at all
Me neither but now I’m interested in Femboi-Hooters 👀
Oddly specific
C is a makeshift kitchen deep in the Lacandon Jungle. If you burn your food, you start a forest fire and die.
can you really call python programming though? The reason why python is so quick to write is because its so-called libraries are pre-compiled C programs. so you’re not writing new programs, you’re scripting existing ones.
The same is true for JVM bytecode, and C operations really are just aliases for ASM operations, and ASM (sometimes) is just aliases for microcode operations
Is scripting programming?
not really, imo. its more like a sequenced list of pointers to various instruction sets.
But there are still if, while, function definitions, etc. in scripting languages. It doesn’t seem to me that different than even programming in assembler. In Assembler you also call subroutines, etc. and in every other language you also call functions from libraries.
And 42 seconds in jython.
Python, Java/TypeScript, C#, Swift, Go…
Java/TypeScript
😒
Ham/ster
Lol, at poo pooing typescript in a thread praising python of all languages
The blind JavaScript hate club never ceases to raise its hand
Dude… Java is not JavaScript
TypeScript might be fine, if it didn’t typically rely on a JavaScript stack that can and will ignore the nominal types.
My indirect experience with python is that it is slow as hell. Anytime I install an app that includes python it lags 15-30 minutes on that step. Anytime I’m asked to install something with conda it takes 30 minutes to an hour.
I’m sure that is just due to environmental and implementation issues, but the Java fans say the same thing…
Yeah conda is slow af, but you can change the env solver which makes things much faster and there’s also mamba/miniconda which I haven’t tried but is supposedly much faster
It’s near-universally regarded as a great prototyping language. For prod you should use something big-boy, like Java, or if you want to get fancy, Rust.
And a second in julia
It’s about writing the code, not execution time. Otherwise Assembly wouldn’t take 7 years…
Some languages are just worse to work with. like JavaScript. Console.log is like sure I’ll log your object but I’ll tell you what it is now, not what it was when you logged it.
I can see it going both ways. Talking about execution times, this would be an exaggeration, but then, these memes always are.