Suggestions for a Java programmer

R

Ray

Hello there,

I've been programming in Java for about 8 years now, but lately I've
been hearing a lot about Python and I'm really interested in learning
more about it. I've read the tutorial, and some books (core python
programming is one), but there's one thing that's still missing: how to
use Python the "Python" way.

I found learning C# was a breeze for me because the language shares a
lot of concepts and notions with Java--I can always say: "I do X this
way in Java, I should be able to do X this way too in C#", and usually
I'm not far off the mark.

But Python is different enough that, even though some basic concepts do
translate easily, idioms and effective usage of it don't come easy. I
can't help thinking that when I'm writing Python, I'm actually writing
Java in Python. Not Python in Python.

Can you point me to "Python for Java Programmers" resources? I found
one blog, but that only touched the tip of the iceberg, I feel. I know
that as I use Python more and read more books and read how experienced
Python programmers code, eventually I'll find it out. But I'd like to
expedite that process if possible. What are your suggestions?

Thank you!
Ray
 
C

Christos TZOTZIOY Georgiou

Can you point me to "Python for Java Programmers" resources? I found
one blog, but that only touched the tip of the iceberg, I feel. I know
that as I use Python more and read more books and read how experienced
Python programmers code, eventually I'll find it out. But I'd like to
expedite that process if possible. What are your suggestions?

Searching google for "python for java programmers" (without the quotes)
produces:

Python for Java programmers - Irmen's Python wiki
Python & Java: Side by Side Comparison
Jython Home Page (which you might like a lot)
dirtSimple.org: Python Is Not Java (some useful pointers)

among others. You didn't specify which blog you found, so HTH.
 
B

bruno modulix

Ray said:
Hello there,

I've been programming in Java for about 8 years now, but lately I've
been hearing a lot about Python and I'm really interested in learning
more about it. I've read the tutorial, and some books (core python
programming is one), but there's one thing that's still missing: how to
use Python the "Python" way.

I found learning C# was a breeze for me because the language shares a
lot of concepts and notions with Java--I can always say: "I do X this
way in Java, I should be able to do X this way too in C#", and usually
I'm not far off the mark.

But Python is different enough that, even though some basic concepts do
translate easily, idioms and effective usage of it don't come easy. I
can't help thinking that when I'm writing Python, I'm actually writing
Java in Python. Not Python in Python.

Can you point me to "Python for Java Programmers" resources? I found
one blog, but that only touched the tip of the iceberg, I feel. I know
that as I use Python more and read more books and read how experienced
Python programmers code, eventually I'll find it out. But I'd like to
expedite that process if possible. What are your suggestions?

These two books should help you to get a grasp of Pythonic idioms:

http://www.mindview.net/Books/TIPython
http://diveintopython.org/
 
V

Ville Vainio

bruno> These two books should help you to get a grasp of Pythonic idioms:

....

Regarding a Java programmer moving to Python, a lot of the mindset
change is about the abundant use of built in data types of Python. So
a Java programmer, when confronted with a problem, should think "how
can I solve this using lists, dicts and tuples?" (and perhaps also my
new favourite, sets). Class-based solution should be chosen only after
seeing that the problem can't be trivially solved with built-in types.
 
R

Ray

Hi Christos,
On 24 Mar 2005 00:22:09 -0800, rumours say that "Ray"
<[email protected]> might have written:

Searching google for "python for java programmers" (without the quotes)
produces:

Python for Java programmers - Irmen's Python wiki

Yes, I feel that this wiki touches more on how Java compares to Python
(as opposed to how to *think* in Python). Maybe I should get the Python
Cookbook to absorb more of the Python way of thinking, you think?
Python & Java: Side by Side Comparison

This also compares Java & Python, the differences of which I am already
aware of.
Jython Home Page (which you might like a lot)

Thanks, I've used it before, but I feel that I was using it to "write
Java in Python"
dirtSimple.org: Python Is Not Java (some useful pointers)

This is the one I was referring to. I'm looking for something like this
(how some common idioms in Java is not the best way to do it in Python,
and how to do things the Python way).

Thanks!
Ray
 
R

Ray

Ville said:
Regarding a Java programmer moving to Python, a lot of the mindset
change is about the abundant use of built in data types of Python. So
a Java programmer, when confronted with a problem, should think "how
can I solve this using lists, dicts and tuples?" (and perhaps also my
new favourite, sets). Class-based solution should be chosen only after
seeing that the problem can't be trivially solved with built-in
types.

Hmmm, but isn't it the same as a Java programmer who's familiar with
the Collection Framework? (Which has list, dict (map), and set)?
 
J

Jeremy Bowers

Can you point me to "Python for Java Programmers" resources? I found one
blog, but that only touched the tip of the iceberg, I feel. I know that as
I use Python more and read more books and read how experienced Python
programmers code, eventually I'll find it out. But I'd like to expedite
that process if possible. What are your suggestions?

Also don't be afraid to post a "this ought to be easier" post here. While
it will most like rapidly turn into an unofficial contest for regulars to
post the niftiest solution, the first few messages will be helpful, and
you'll leave Google fodder for future people with that concern. And
besides, the contest might teach you several other things as well.
Basically, everybody wins :)
 
K

Kent Johnson

Ray said:
types.

Hmmm, but isn't it the same as a Java programmer who's familiar with
the Collection Framework? (Which has list, dict (map), and set)?

Python collections are vastly easier to work with. In particular for creating, iterating and nesting
collections there is really no comparison between Python and Java. As a result, my Python programs
use collections much more than Java programs.

To respond to the OP, I recommend the book "Python Cookbook" as a way to learn the Pythonic view. It
doesn't contrast Python with Java, but it gives many examples of idiomatic Python

Kent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top