Good introductions to Python?

Status
Not open for further replies.

truth is life

Ars Scholae Palatinae
1,189
I'm a graduate student who is working on a LARGE_RESEARCH_PROJECT that involves a large custom code/framework base we use for various purposes (doing simulations, processing data...), written in a combination of C++ and Python. In high school I took two years of computer science (which used Java; it was an AP-oriented course), so I'm not a complete noob at programming, but for various reasons I fell rather out of practice during my bachelor's degree, so I've basically had to start relearning how to program from scratch so that I can work with this framework--write plugins for it, understand what existing code is doing (because the documentation is terrible), and so on.

So far I've been focusing on the C++ side, especially since most of the stuff that I'm actually working with is in C++, but I wanted to start familiarizing myself with the Python side of the equation. Does anyone know of any resources for learning how to use Python for someone who isn't a complete beginner, but probably couldn't be considered intermediate in overall programming knowledge and skill?
 

truth is life

Ars Scholae Palatinae
1,189
[url=http:/civis/viewtopic.php?p=25354909#p25354909:23yt4zsj said:
Faramir[/url]":23yt4zsj]
[url=http:/civis/viewtopic.php?p=25353171#p25353171:23yt4zsj said:
kperrier[/url]":23yt4zsj]Learn Python the Hard Way
Is that really a good choice for someone who can already program in a different language? I've mostly seen it recommended for people coming to programming for the first time.
Yes, this is exactly why I asked if anyone had any suggestions for other resources. I looked at it, read through the first couple of lessons, and decided that it was pitched at someone less comfortable and familiar with programming than me. I don't really need (or want) that degree of hand-holding.
 

daveIT

Ars Tribunus Militum
1,984
I was looking at the Learn Python the Hard Way website and noticed it recommends to install Python 2.X not 3.x. I've been doing some research and came across this, which will hopefully help others.

Looking at O'Reilly's "Learning Python, 5th edition":


"Which Python Should I Use?
Version choice may be mandated by your organization, but if you’re new to Python and learning on your own, you may be wondering which version to install. The answer here depends on your goals. Here are a few suggestions on the choice.

When to choose 3.X: new features, evolution
If you are learning Python for the first time and don’t need to use any existing 2.X code, I encourage you to begin with Python 3.X. It cleans up some longstanding warts in the language and trims some dated cruft, while retaining all the original core ideas and adding some nice new tools. For example, 3.X’s seamless Unicode model and broader use of generators and functional techniques are seen by many users as assets. Many popular Python libraries and tools are already available for Python 3.X, or will be by the time you read these words, especially given the continual improvements in the 3.X line. All new language evolution occurs in 3.X only, which adds features and keeps Python relevant, but also makes language definition a constantly moving target—a tradeoff inherent on the leading edge.

When to choose 2.X: existing code, stability
If you’ll be using a system based on Python 2.X, the 3.X line may not be an option for you today. However, you’ll find that this book addresses your concerns, too, and will help if you migrate to 3.X in the future. You’ll also find that you’re in large company. Every group I taught in 2012 was using 2.X only, and I still regularly see useful Python software in 2.X-only form. Moreover, unlike 3.X, 2.X is no longer being changed—which is either an asset or liability, depending on whom you ask. There’s nothing wrong with using and writing 2.X code, but you may wish to keep tabs on 3.X and its ongoing evolution as you do. Python’s future remains to be written, and is largely up to its users, including you.

When to choose both: version-neutral code
Probably the best news here is that Python’s fundamentals are the same in both its lines—2.X and 3.X differ in ways that many users will find minor, and this book is designed to help you learn both. In fact, as long as you understand their differences, it’s often straightforward to write version-neutral code that runs on both Pythons, as we regularly will in this book. See Appendix C for pointers on 2.X/3.X migration and tips on writing code for both Python lines and audiences.

Regardless of which version or versions you choose to focus on first, your skills will transfer directly to wherever your Python work leads you."
 
[url=http:/civis/viewtopic.php?p=25356175#p25356175:3pawebtp said:
truth is life[/url]":3pawebtp]
[url=http:/civis/viewtopic.php?p=25354909#p25354909:3pawebtp said:
Faramir[/url]":3pawebtp]
[url=http:/civis/viewtopic.php?p=25353171#p25353171:3pawebtp said:
kperrier[/url]":3pawebtp]Learn Python the Hard Way
Is that really a good choice for someone who can already program in a different language? I've mostly seen it recommended for people coming to programming for the first time.
Yes, this is exactly why I asked if anyone had any suggestions for other resources. I looked at it, read through the first couple of lessons, and decided that it was pitched at someone less comfortable and familiar with programming than me. I don't really need (or want) that degree of hand-holding.

What exactly do you want to know about Python?

I find that when it comes to these kinds of threads ("I already know X but I want to learn a new language!") it's much easier to ask about how to do a specific task or problem than it is to step through a tutorial - you know, minimalist learning and all. I learned Python almost exclusively by just searching for examples on the web, but I also was familiar with Ruby and the distance between Python and Ruby is tiny.

If you're just looking for Python idioms and styles, maybe this?

http://python.net/~goodger/projects/pyc ... ndout.html
 
C++ and python are significantly different in that C++ is entirely ambivalent about whether or not the developer destroys their entire life trying to make something work, while python generally tries to help you not do the wrong thing.

Both python and ruby are from a class of languages with fairly sane, usable and well-documented language cores, though. It's not necessarily a language that needs a ton of introductory reading, simply because the syntax and grammar don't really contain any dragons.
 
Is that really a good choice for someone who can already program in a different language? I've mostly seen it recommended for people coming to programming for the first time.

Read the official Python tutorial first, then work through some challenges on the various challenge sites. Also check out the Python Module of the Week at http://pymotw.com/2/ and it's corresponding book.
 
Status
Not open for further replies.