5 ms·
I don't get why Python can't replace Java in almost all domains. It's exceptionally well structured and fast enough for most use cases.
by kumarvvr 9y ago
I don't get why Python can't replace Java in almost all domains. It's exceptionally well structured and fast enough for most use cases.
- pjmlp 9y agoMaybe one day, when CPython guys start taking JIT seriously and finally get rid of GIL.
- kumarvvr 9y agoIsn't multiprocessing + caching like Redis a good enough workaround? I know that it works well for web applications. Not sure about other domains.
- pjmlp 9y agoThe day Python performance gets good enough for companies to even think about doing a complete OS userspace on it, maybe. Until then, no.
- orf 9y agoThat's.... Ridiculous.
- pjmlp 9y agoRidiculous is suggesting Python is capable of replacing Java in what concerns performance. Specially when it needs extensions written in C or C++ for anything that requires it.
- orf 9y agoRidiculous is thinking you could write a whole OS userspace in Java. Ridiculous is making that comment without realising Python is a core part of most modern *nix userspace. try uninstalling Python on a default Ubuntu/Fedora/Centos install and see what still works. I would suggest trying the same with Java, but nobody bundles that by default despite it's JIT. Ridiculous is pontificating about how useless Python is without C/C++, clearly without knowing much about the language and its strengths. I've known people who say the same kind of things, who write reams of very poor, unidiomatic Python code and wonder why it's slow, not wanting to accept that it's their bad code that's slow!
- pjmlp 9y agoJNode, JX, JavaOS, Android are a fact. Let us know when there is an OS with Python userspace that can compare to any of them. Of course Python is a core component of any UNIX system, it is a perfectly good fit as scripting language. As a replacement for complex shell scripts, libraries written in C and C++, or scripting GUI applications.
- orf 9y ago> JNode, JX, JavaOS, Android are a fact. I'm not sure if you're being intellectually dishonest or just willfully ignorant, but except Android all of those projects are long dead or discontinued. It seems Java wasn't a great choice. And while Android uses the same syntax as Java under the hood it's a completely different and doesn't share any code with, one very different from the JVM (Yes, Java != the JVM, but you're whining about the CPython implementation of Python rather than the syntactical differences compared to Java) I mean this whole thread is ridiculous, you start out by saying "Python is bad because you can't write an OS user-space in it" which by itself is entirely ridiculous. You defend this by saying "Java is fast, therefore Python is bad". You like to troll around these Python threads saying the same thing, "boo Python is bad because it's slow" and "boo where is the Python JIT". By all means make these points, but until you put some actual substance into your arguments they will continue to come across as very confused. And honestly it does seem like you are very confused. > As a replacement for complex shell scripts, libraries written in C and C++, or scripting GUI applications. https://en.wikipedia.org/wiki/User_space https://en.wikipedia.org/wiki/User_space
- pjmlp 9y agoThose projects were done and ran in actual hardware. I am making the counter point regarding OP statement that Python is suitable to fully replace Java ,regardless of the implementation. Lets not mix languages and implementations. So given that even PyPy does not match the performance of most Java implementations, it seems a bit hard to consider the scenario of Python fully replacing Java's use cases.
- 9y ago
- nicolaslem 9y agoMultiprocessing is not a free launch neither. I rediscovered recently many issues related to fork. Luckily I mostly write IO bound code, so sticking with GILed threads is an option for me.
- yen223 9y agoThe fact that almost everything in Python is mutable by default pretty much guarantees the GIL is never going away.
- pjmlp 9y agoThat doesn't affect other languages with similar semantics. Not even alternative Python implementations for that matter.
- yen223 9y agoWhich other language shares Python's level of dynamism - where object attributes can be conditionally deleted at runtime, for example - and manages to have convenient thread-safe operations?
- pjmlp 9y agoCommon Lisp, Smalltalk, Dylan. And as I said, Jython and IronPython also don't have a GIL.
- foepys 9y agoJava's tooling support blows Python's tooling support right out of the water. The static type system of Java allows faster refactoring and IMHO makes development of large applications easier and less error prone. I use Python for simple scripts and often for data transformation. But e.g. at work we have a few million lines of C# that I would never ever want to manage if it was written in Python.
- kumarvvr 9y agoDo you mean tooling in the sense of Debugging support? Or is it code generation, etc? Just curious. I use PyCharm for medium to fairly complex projects and with Python 3 type hinting, I have not faced any particularly difficult development situations, tooling wise.
- foepys 9y agoWell, type hints are a relatively new addition to Python and while they are nice, not every code has them and you cannot rely on them 100%. Python in general is a cool language that you can build stuff fast in but is is also extremely dynamic which doesn't make it good for IDE support where you often want to know where stuff is coming from in one click. Large code bases can get very confusing and navigating in a module you don't know is easier with IDE support. Debugging in Python has gotten very nice but I feel like it's still easier in Java. I'm always very bad at finding examples, sorry :/
- joshuamorton 9y ago>you cannot rely on them 100% You can rely on them exactly the same amount as in Java though.
- ageofwant 9y agoI always find it peculiar that people seem to defend a million line code base, like that is something to be proud off. The days I walk out of the office with less code in some mature project's repo are the days I know I accomplished the most.
- diebir 9y agoFor one, the package management in Python sucks so bad it's not funny. This alone is a reason enough for me to never touch Python again.
- y4mi 9y agoWhile pipenv [1] isn't perfect, it does sooth that pain quite a bit. [1] https://github.com/pypa/pipenv https://github.com/pypa/pipenv
- joshuamorton 9y agoYes but "sucking so bad its not even funny" is still superior to maven and ant (and as another user mentioned, pipenv is a very good approximation of Cargo, which is a really good build and package management system).
- pjmlp 9y agoI would take Maven and Ant any day over having to play with virtual environments, multiple Python installations and Python 2/3 dictonomy.
- zimablue 9y agoYou mean dichotomy, and the war is pretty much over everything supports python3 now.
- pjmlp 9y agoThanks for the correction. Pretty much is not everything, for example Cocos2d-x scripts.
- joshuamorton 9y agoThat's not a library, it's a platform. There are all kinds of platforms stuck on ancient Java versions (Android), for which libraries are not always compatible. Every package you'll use is compatible, unless you're Mozilla's build system.
- anta40 9y agoWriting native Android apps using Python, perhaps? :D
- earenndil 9y ago> fast enough for most use cases. I take issue with this. In terms of speed, python can't even hold a candle to java. Even when using pypy, which isn't 100% compatible with cpython.
- mamcx 9y agoI love python. And hate Java (as logical is to hate a language, ok?) Java have a super big assets: A very powerfull VM. And this is the part where python is not as good. Is sad that Python3 was not used as the moment to build up a good VM, but well, history is history. And this actually mean: Put a very strong and well funded team behind it. Make a good VM for python is hard