views:

335

answers:

8

I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack.

I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use.

There are some legacy Python applications that I have been asked to support going forward, I have no exposure to python and dynamic languages in general(although I've done a fair bit of JavaScript).

I was hoping to get some guidance/advise to aid in how to go about learning a language like python for the statically typed mind.

EDIT: Using IronPython is not an option!

+1  A: 

I would recommend using IronPython to help you learn. It is an implementation of Python on the .NET framework. So you can use/learn Python with access to the .NET class library.

A good place to start is by downloading IronPython and looking at IronPython in Action, which is a very good book looking at Python on the .NET framework.

EDIT: Since IronPython is not an option, disregard this answer. Thanks though.

ecounysis
+10  A: 

Foord and Muirhead's IronPython in Action is an amazingly good book, perfectly suitable for teaching Python to .NET folks as well as teaching .NET to Python folks. I may be biased, as I was a tech reviewer and Foord is a friend, but I've had other cases in the past where a friend wrote a book and I tech reviewed it -- and ended up deciding the book was just wrong and publicly saying so (way to lose friends, but, I just can't tell a lie, not where Python is concerned at least!-)

Edit: If you're forbidden from moving to IronPython (which would probably support your legacy apps just fine, btw), there are better answers: Mark Pilgrim's Dive into Python is often considered the best Python intro for the experienced developer, and my own Python in a Nutshell has been praised as the fastest way onboard for superstar developers. I am of course biased in favor of these -- Mark is a colleague, and my wife was a key tech editor for his book (and my own as well), and obviously I'm biased in favor of my own book too;-). But then, I do tend to be biased towards a lot of the best Python books, as I've either had a hand in their editing, or am friends with their authors, or both;-).

Alex Martelli
Is the focus of this book to target the .NET framework with python? if so, then this is not what I'm looking for since I need to support legacy apps written in python
Abhijeet Patel
If you're forbidden from moving to IronPython (which would probably support your legacy apps just fine, btw), there are better answers, let me edit my answer to mention them.
Alex Martelli
Alex: Does Iron Python 2.0.1 integrate with Visual studio i.e can you create and open IronPyton projects in VS?
Abhijeet Patel
@Abhijeet, several possibilities: most promising as a turnkey solution is http://ironpythonstudio.codeplex.com/ -- for deeper understanding, http://ironpython-urls.blogspot.com/2008/07/visual-studio-ironpython-integration.html and links from it seem good too.
Alex Martelli
Alex: IronPython studio looks promising.. I'll try it out,also any other IDE recommendations(non IRON Py), I've heard that the PyDev plugin for eclipse is worthwhile, any other(free) ones that you can recommend?
Abhijeet Patel
@Abhijeet, sorry, I'm not really much of a GUI IDE guy (vim and shell are always my "IDE" of choice, personally;-). I remember WingIDE as having THE best debugger I've ever used, bar none -- worth using for debug of subtle bugs in a multi-threaded app that was defeating every other debugger I threw at it AND my poor mind too;-) -- "but that was in another country, and besides, that application is dead";-).
Alex Martelli
+1  A: 

The book Pro IronPython is worth reading too if you have time.

sunqiang
+4  A: 

Hardest thing I was confronted to in using python coming from Java was to properly wrap my head around the Duck Typing thing... At first I thought it was just plain horrible and just dressed the hairs on the back on my neck.

Next is the scope by convention, but that one is pretty easy. And the importance of white spaces gave me a few bumps.

However once you ease yourself in the language's concision and speed of development you learn to appreciate it a lot more. After a while I thought it was the best thing that ever happened to me !! :-)

here are a few things that helped me a lot :

First I started with this book and got the basics of the language and for everyday use the Python Quick Reference Card was very helpful. Also the console will be your best ally to try quick things and solidify your learning.

For IDEs, coming from the eclipse world PyDev was a natural choice for me, but there were many more to choose from.

Good luck, Hopefully you'll find Python as much fun as I did.

Newtopian
+1  A: 

There is a big initial hurdle of getting comfortable with dynamic typing. The first step is when you look at Python-code and realize that variables aren't defined anywhere, you just create them out of thin air, which feels like jumping over a cliff. There is a brief moment before your hang glider catches the air properly.

And then it's going to take time before you trust your newfound dynamic wings, and you probably only can get their by doing aerobatics with them. Learn how python handles references, have fun with monkey-patching methods, duck type various animals. Try to learn some ugly tricks.

And although you can't use IronPython for this, there is no reason you can't use it to learn Python.

Lennart Regebro
+1  A: 

I would recommend just to read a book about it. A book for beginners. It'll contain many stuff you already know but you won't miss anything regarding using a dynamic language. I can point you to Dive into Python, which seems to be very friendly, or The Python Tutorial which seems to be very to the point (that's how I learned).

J. Pablo Fernández
+1  A: 

You're going to experience quite a bit of culture-shock going from C# to the wild duck-typed outback of Python. Lack of types and intellisense can be pretty daunting. Good thing that you're experienced in JavaScript. Also know that indent-sensitive block rules of Python can be very confusing for the inexperience (usually you either love it or hate it :-)

Apart from that the biggest challenge moving from one language to another is usually the framework. Getting to know all the classes and functions Just Takes Time unfortunately.

Per Erik Stendahl
+1  A: 

For an experienced developer learning Python, Dive Into Python is a very good book.

Wesley Chun's Core Python Programming book takes a more "ground up" approach, which may be a little slow for an experienced developer. But it allowed for very easy comparisons of the basic syntax and operators compared to other languages. Wesley's writing style is very easy to read, and his example projects are non-trivial enough to actually be interesting.

The Python Cookbook is an excellent reference for learning to program in a 'Pythonic' way. This book contains hundreds (?) of examples of how to solve common everyday problems with Python. In general, the "Cookbook" series will expose you to the idioms of the language faster than any other book.

Whenever I need to learn a new programming language, I start using it for all the 'daily maintenance' tasks that come up - all the little things that I would normally solve with a shell script or with common unix tools - I start to use the new language to solve those problems. Since you have .NET experience, IronPython is probably a good way to leverage that knowledge while learning Python. Even if you only install IronPython in a personal sandbox...and use it for all your daily busy work coding tasks - that can be a great way to learn the syntax and idioms of Python.

semiuseless