DISQUS

/var/log/mind: Commentary on Python from a Java programming perspective

  • Brian Clapper · 1 year ago
    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.
  • Dhananjay Nene · 1 year ago
    Quite interesting indeed. A fair bit of similarities I must confess with code snippets as well.
  • David Goodger · 1 year ago
    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/...
  • Dhananjay Nene · 1 year ago
    David,

    Nice tutorial and great references as well.

    Thanks.
    Dhananjay
  • prashant · 1 year ago
    Hi,

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

    Thanks
    prashant
    http://www.prashantjalasutram.blogspot.com
  • danfairs · 1 year ago
    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.
  • Dhananjay Nene · 1 year ago
    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.
  • apang · 1 year ago
    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 :)
  • sindhu · 1 year ago
    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.
  • JS · 1 year ago
    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?
  • Dhananjay Nene · 1 year ago
    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
  • Laurent · 1 year ago
    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.