DISQUS

DISQUS Hello! /var/log/mind is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

/var/log/mind

Dhananjay Nene’s free (as in free speech) opinions on all things related to Software Engineering
Jump to original thread »
Author

Commentary on Python from a Java programming perspective

Started by Dhananjay Nene · 9 months ago

After having worked with Java (and earlier C++) for a number of years, I have been working with Python for the last few months. Since I came to Python from Java, I thought it might be useful to share my experiences, which might be of interest to many Java programmers. This is not inten ... Continue reading »

12 comments

  • Funny... I wrote a similar blog article a couple months ago. See http://brizzled.clapper.org/id/75

    It's quite interesting to read others' experiences.
  • Quite interesting indeed. A fair bit of similarities I must confess with code snippets as well.
  • Welcome to Python!

    You may be interested in a tutorial I gave in 2007 at PyCon and OSCON, "Code Like a Pythonista: Idiomatic Python". Full notes here: http://python.net/~goodger/projects/pycon/2007/...
  • David,

    Nice tutorial and great references as well.

    Thanks.
    Dhananjay
  • Hi,

    nice article.I am also learning ruby although i am a java developer just for fun.

    Thanks
    prashant
    http://www.prashantjalasutram.blogspot.com
  • Don't confuse Python-the-language with the Python runtime. I guess you were probably using CPython, which is the (de-facto standard) Python interpreter written in C. You'd probably also be interested in Jython, which will let you compile Python down to Java bytecode. 'Python' isn't necessarily slow; a particular implementation may be.

    You don't give any specific examples of where you found CPython to be slow (for some definition of slow), but I'd be interested to see sample code, benchmarks, and perhaps a run on Jython as well.

    I spend around 50% of my time in C# (whose tools have similar refactoring capabilities to IDEs such as Eclipse), and the rest in Python. While my development environment for Python (TextMate or emacs) certainly don't have refactoring tools like Visual Studio exposes (and I suspect whatever your chosen Java IDE is also does) I've found that I simply don't need them; a search and replace answers 80% of the common cases. Can you give an example of a refactoring operation that you do with your Java tools that you missed with the Python tools?

    It's probably worth mentioning that Python does have high-quality IDEs (Wing springs to mind). These may offer refactoring tools.
  • Yes, I was indeed using CPython.

    While I have conducted benchmarks on at least 10 occasions, I haven't kept records of the same. However the one time I did maintain detailed records, I documented these here : http://blog.dhananjaynene.com/2008/07/performan... , it includes a benchmark on CPython, Jython and psyco as well. I will stand by my assertion that there is indeed a substantial difference in run time performance on most counts.

    An example of tough refactoring is changing the method name in a scenario where the method is being used in a class hierarchy.
  • Exiting to the command line and executing code? How about running an inferior process in emacs and sending the current region? Any language without eval feels like a pain to use for me :)
  • Am learning Java at College currently, almost done with the intermediate stuff, I've been wanting to learn python since all the web APIs seem to prefer that. I really liked the article I could relate to it, It would be nicer though if you broke them up into paragraphs, kinda hard to read a long chunk of text, I lost track whenever I shifted focus.
  • Hello,

    One neat thing about Python is that if you have performance bottlenecks, you can drop down into C/C++ code to rewrite just those parts of your system that have problems. How come you don't see this approach as viable as simply writing the whole application in Java instead of Python with some parts rewritten in C?
  • JS,

    I concur it is indeed a viable approach and that it is possible that I could
    choose to exercise that optiion as well. I think it will indeed depend on
    the nature of the application and its distribution model. I would think that
    if the application hotspots are fairly localized and if it is intended to be
    used in few installations, then using C/C++ indeed becomes a attractive
    option.

    Dhananjay
  • Interesting article. But was it a team project? I wish there were more people sharing their experience about an (average) team of java developers doing a project in those dynamically typed languages... IMHO it might be painful.

Add New Comment

Returning? Login