TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java for Python programmers

49 pointsby gh1over 8 years ago

10 comments

ameliusover 8 years ago
The problem with learning a new programming language lies not in learning a few language constructs; it lies in getting to know the libraries and the whole ecosystem around the language.
评论 #13122802 未加载
评论 #13122500 未加载
评论 #13123196 未加载
评论 #13124210 未加载
Philipp__over 8 years ago
After a lot of Pascal (had it in high school and first year of uni, wrote some bigger CRUD apps in it, silly I know) and C, it was really hard for me to adopt python. I just couldn't shake the feeling that I had to do everything myself, (even though python provides you with everything you need, I end up writing some function which with a bit of googling already exist as a part of language), that I got from C and Pascal (where I had to write even my own text parser for some apps I did). So I was bashing my head against the wall every time I tried to use python. So in the end I failed and Java was next thing I hit. It was cool. But it was interesting that after learning Java it was much much more easier for me to adopt Python. It was weird in the beginning where you have function for a lot of things, but Java seemed to have rewired something in my head. ¯\_(ツ)_/¯ after using Java my Python was much better. Still not good enough in my opinion, as it is hard for me to wrap my mind around some concepts that are different in Python, where you do not have to type a lot, and things are pretty much done with using packages and functions (external or internal API). It seems like a lot of alchemy and blackboxes to me (python little less, but Javascript is totally like that). And I read a lot of books, even some practical ones, wrote few smaller projects, but it always blew my mind that I write ~100 line program in python, and exact same thing would take me like few hundreds or even thousands in C. But I am mostly interested in systems/OS programming so understand me...
评论 #13122639 未加载
mttjjover 8 years ago
Does anyone know of any resources like this to go the other way - Java to Python? I know a minimal amount of Python but want to learn more. And I know Java very very well. I feel like this learning style is perfect for me and would help me understand Python a lot better.
评论 #13122845 未加载
评论 #13122740 未加载
评论 #13122787 未加载
rodorgasover 8 years ago
"Why Learn Java? Why not C or C++? If you know Java learning C++ is easy." Really?
评论 #13122569 未加载
评论 #13123095 未加载
anondonover 8 years ago
The code samples are striking: they demonstrate how verbose Java can be, compared to Python!
评论 #13123090 未加载
评论 #13123074 未加载
评论 #13123078 未加载
qwertyuiop924over 8 years ago
I just have one question: Why?<p>Why, in this day and age, learn Java unless you absolutely must? (which you probably will, at some point, but if you&#x27;re lucky, maybe avoid it). It was a pretty miserable language to begin with, and has since been surpassed in just about every way.<p>If you&#x27;re thinking about using Java for a project, you can probably use C, Rust, or JS&#x2F;Python&#x2F;Ruby&#x2F;etc. Hell, you could even use Haskell, ML, Lisp, or Smalltalk, if you&#x27;re that sort of person.<p>But don&#x27;t use Java if you can avoid it. It will make you feel better, likely improve your productivity, and make you stop wishing that you could commit seppuku.
评论 #13123044 未加载
评论 #13123262 未加载
评论 #13123368 未加载
sjclemmyover 8 years ago
I wish there was a Java for JavaScript programmers. I was looking for one the other day, couldn&#x27;t find it. There are plenty of JavaScript for Java devs!
uh-0hover 8 years ago
public class Hello {<p><pre><code> public static void main(String[] args) { StringBuffer output = new StringBuffer(); Process p; try { p = Runtime.getRuntime().exec(&quot;pwd&quot;); p.waitFor(); java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream())); String line = &quot;&quot;; while ((line = reader.readLine())!= null) { output.append(line + &quot;\n&quot;); } } catch (Exception e) { e.printStackTrace(); } System.out.println(output.toString()); } </code></pre> }<p>&#x2F;home&#x2F;jobe&#x2F;runs&#x2F;jobe_AnIK6J<p>probably not a good sign....<p>Do python repls let you execute anything on the host?
Spivakover 8 years ago
I only used Java when I was in school, has the standard changed to always use the boxed type?<p><pre><code> for (Integer i = 0; i &lt; 10; i++ ) { System.out.println(i); }</code></pre>
评论 #13123172 未加载
berntbover 8 years ago
I guess the real reason for a scripting language programmer to go Java is that you want to use the JVM?<p>Otherwise, wouldn&#x27;t it be simpler to just profile to find the slow places in your existing code -- then rewrite those in C? You can use the scripting language for most code, where it shines -- speed of development. And still get a good speed of execution.<p>If you need even more speed (you wouldn&#x27;t really get less memory usage!), then sure... Java is one way to go for a Python&#x2F;Ruby&#x2F;Perl&#x2F;PHP guy. But... when is it the best choice?
评论 #13123251 未加载