Tuesday, November 9, 2010

More Impressions of Python (from a Java developer)

Jeff Bail has just written an article on his first impressions of Python. I've been teaching myself Python for the last two weeks as well and I generally share Jeff's impresssions. I just wanted to add some more.

Compared to Java

Python is not that different from Java. Generally it is said that Python is easy to learn. For Java developers it is probably even easier. It's not that different like a Lisp for example. Language constructs are similar. It's object-oriented, you got packages, classes and methods, for-loops and so on. But it's dynamic, so it's a bit more like Groovy.


Object-orientation seems a bit clumsy (a bit like JavaScript). For example the attributes of a class are declared in the constructor (dynamically) and there is no this keyword, instead a self parameter is passed to the methods of a class to get hold of the instance. I don't know exactly but it feels like object-orientation wasn't part of Python from the beginning. Nonetheless, Python's dynamical nature makes object-orientation very flexible.

Functional Programming

Python supports functional programming. Functions are first class citizens and can be passed around as parameters to other functions for example.


After reading a book about Python I wanted to actually use it in a simple web project with Django. Django is a web application framework similar to Ruby on Rails or Grails. One great feature of Django is it's O/R-Mapping and querying features. A little drawback, but that's more a matter of personal taste, is that it's MVC and template based with a templating language. I've used that in Java with Spring MVC and Freemarker long time ago, but meanwhile I mostly prefer component-based frameworks like Apache Wicket.


I haven't gotten really deep into Python by now, but my first impressions are generally very positive and I already feel comfortable with it. I will also have a look at some other web frameworks in the future, any recommendations?


Santonian said...

I think we have to tighten your SSZ schedule! ;-)

Sury said...

Try Twisted Web / Nevow framework for your next python based web framework. Add it with ExtJS

Shadowless_Sword said...

try pylone framework

manatlan said...

You should take a look around WSGI.
It's a lot more interesting that what web frameworks offer. And 99% of the time, python web frameworks are based on WSGI.
Learn WSGI, and you will see the light. You will see that you could build easily, from scratch, your own based web frameworks, with the lot of WSGI things that already exist.
You will learn many ways to reroutes your url, and you could mix them. You could build your own, mixing MVC style or components based. You will learn how it's easy to build your exact needs.

Jazzie Casas said...

Java and to some degree .Net are the main choices because they have been consistently pegged as the “safe” choice to go with for mid-level project managers in the corporate world. No one was ever fired for choosing Java or Microsoft.

However, there are many large distributed applications these days that run primarily with technologies like Python, PHP, et al. Even companies like Google and Yahoo are heavily invested in these technologies. Java may be the main choice for enterprise development now, but it’s days are numbered as the only stalwart option to go with.

Let’s face it, many of these so called “enterprise applications” could easily have been written much faster and with less overhead using technologies like Python, PHP, et al.

open source training

Paulo A Pereira said...

I'm thinking about following your path ... i'm no java expert but one thing is for sure it's easyer to be "feature full" and "grounbreaking" once you break compatibility ... see the python 3 issue about breaking compatibillity with 2.x version. Java, being in use in the enterprise cannot afford to make those "groundbreaking" changes. But don't take my words as a disaproval, i do want to learn python ... still i'm waiting for a while for python 3.x ubiquity (i.e. Django with python 3). No need to learn now and then learn again tomorrow to do the same thing !

Christian Harms said...

Javascript is a prototype-based languange, python and java "normal" object-oriented languages. If you are interessed in the functional part, read the indroduction on united-coders.com. django is a good choice to start with web-developing and you can deploy your web project (with small changes) on the google app enigne for free.

Web Design Firm said...

These are very effective for new developer who are jumping in this field.

- Tanya
Web Design Firm