Python for Java programmer

6 views
Skip to first unread message

Nirav Thaker

unread,
Dec 14, 2007, 11:53:17 AM12/14/07
to
Yo Group,

I'm excited to learn Python as new language coming year, I consider
myself good Java developer and, not so unusually, with very limited
experience with dynamic programming languages such as Python or Ruby.

I have started with basics at http://docs.python.org, but I'm more
interested in learning philosophies in programming dynamically typed
languages, I really want to get rid of those Enterprisely weird Java
techniques.

I'm looking for good resources and a better technique to learn Python,
would appreciate book references or URLs for them (Google explodes me
with info. and I don't really have time to read all that). Also, I'm
looking forward to hack some framework or library written in Python to
get a good deal of exposure to language and class library, So it would
be great if anyone would suggest such framework as well.

Looking forward for suggestions Python community!

Thanks,
Nirav Thaker
http://blog.nirav.name

George Sakkis

unread,
Dec 14, 2007, 12:06:52 PM12/14/07
to
On Dec 14, 11:53 am, Nirav Thaker <nirav.tha...@gmail.com> wrote:
> Yo Group,
>
> I'm excited to learn Python as new language coming year, I consider
> myself good Java developer and, not so unusually, with very limited
> experience with dynamic programming languages such as Python or Ruby.
>
> I have started with basics athttp://docs.python.org, but I'm more

> interested in learning philosophies in programming dynamically typed
> languages, I really want to get rid of those Enterprisely weird Java
> techniques.
>
> I'm looking for good resources and a better technique to learn Python,
> would appreciate book references or URLs for them (Google explodes me
> with info. and I don't really have time to read all that). Also, I'm
> looking forward to hack some framework or library written in Python to
> get a good deal of exposure to language and class library, So it would
> be great if anyone would suggest such framework as well.
>
> Looking forward for suggestions Python community!

You may want to check out these first:

http://dirtsimple.org/2004/12/python-is-not-java.html
http://www.razorvine.net/python/PythonComparedToJava

George

Bruno Desthuilliers

unread,
Dec 14, 2007, 4:54:27 PM12/14/07
to
Nirav Thaker a écrit :

> Yo Group,
>
> I'm excited to learn Python as new language coming year, I consider
> myself good Java developer and, not so unusually, with very limited
> experience with dynamic programming languages such as Python or Ruby.

Then you'll probably have to unlearn a few things...

> I have started with basics at http://docs.python.org, but I'm more
> interested in learning philosophies in programming dynamically typed
> languages, I really want to get rid of those Enterprisely weird Java
> techniques.

Fine !-)

A good start is of course the now famous "Python is not Java" article:
http://dirtsimple.org/2004/12/python-is-not-java.html

Also FWIW, the dynamic part is not restricted to typing. You can
dynamically modify class or instance attribute set (including methods),
hook into lookup rules or class creation, dynamically create functions,
classes or modules, etc... Syntax errors set aside, everything happens
at run time.

> I'm looking for good resources and a better technique to learn Python,
> would appreciate book references or URLs for them (Google explodes me
> with info. and I don't really have time to read all that).

Having a decent knowledge of Python's object model (with special
attention to the lookup rules - and how you can hook into -, the
operators overloading and other __magic__ methods, and of course
metaclasses) may help - since everything in Python is an object
(including modules, classes, functions etc). Once you understand what's
a Python object and how it works, you have a chance to start thinking
otherwise about how to structure your programs. Most of the relevant doc
is here:

http://docs.python.org/ref/objects.html
http://docs.python.org/ref/node33.html
http://python.org/doc/newstyle/
http://docs.python.org/ref/specialnames.html

Sadly, there isn't AFAIK any in-depth material exposing these features
and how they can used in real-world. But anyway:

> Also, I'm
> looking forward to hack some framework or library written in Python to
> get a good deal of exposure to language and class library,

Note that the Python libraries (standard and thir-part) are not
necessarily that much class-oriented. With dynamic typing, you don't
need deep class hierarchies. And with everything being an object, you
end up thinking more in term of objects than in terms of classes.

> So it would
> be great if anyone would suggest such framework as well.

Here are a couple packages I learned (and I'm still learning) from:

- SqlAlchemy : a hi-level interface to RDBMS, including (but not
restricted to) an ORM layer,
- Elixir: a declarative layer on top of sqlAlchmy's ORM features,
- FormEncode : a conversion/validation lib, mostly used for the web but
usable for any outer-world/your-program data exchange. The "declarative"
API it's built upon is really worth reading if you want to see Python's
power in action, but beware, there are really things in it one should
not show to childrens !-)

HTH. And welcome onboard.

Berco Beute

unread,
Dec 14, 2007, 5:01:22 PM12/14/07
to
Welcome to Python!

One way to get you up to speed fast (and fun) is take some java app
you've written and implement it in Jython. After you've done that, and
gotten over the pleasant surprise of how short and clean your code has
become, go over the source again and see where you can replace calls
to java libs with calls to Python libs. E.g. for xml & xpath use
ElementTree instead of JDom, for timing use Python's timeit module,
etcetera. Although I've been using Python for a while now I've done
the same thing recently and was surprised by how clearly that exercise
showed Python's strengths.

Just go ahead and start programming is the best way to learn about the
philosophies behind a language.

2B

Berco Beute

unread,
Dec 14, 2007, 5:07:58 PM12/14/07
to

Bruno Desthuilliers

unread,
Dec 14, 2007, 5:13:19 PM12/14/07
to
Berco Beute a écrit :

I'm not sure these articles will bring that much to the OP.

Reply all
Reply to author
Forward
0 new messages