how to learn python (for light bioinformatic stuff)

Discussion in 'Mac Programming' started by pit29, Oct 18, 2008.

  1. pit29 macrumors 6502a


    May 23, 2006
    The Golden State
    Hi all,

    The time has come, and I need to write some stuff in the future in a programming language again. Although there might be workarounds, I'll take it as a welcomed opportunity to learn something - I was fairly good in BASIC and Turbo Pascal back in the days, and know some elementary C and C++ stuff.

    I am working in life sciences; my collaborators use and recommended Python, so I think that's what I am going to learn. I will need this for some basic stuff (I think it'll be basic stuff, but I may be wrong) like getting data from NCBI, sorting and manipulating them. (From what I gather, Perl may be better for string manipulation, but I kind of settled for Python - see above).

    So I am wondering whether someone knows some good ressources for Python. I plan on using Xcode, and on getting O'Reilly's 'Learning Phyton' book. Can you recommend any alternetives? Any suggestions for additional programs or literature? Are there good tutorials on the web, especially for the NCBI part of it?

    I appreciate your suggestions...
  2. CyberBob859 macrumors 6502


    Jun 13, 2007
  3. pit29 thread starter macrumors 6502a


    May 23, 2006
    The Golden State
    Oh, I found that one ... but thanks. I also found

    Maybe I should be more specific (albeit from my still limited point of view):

    1. What is a good IDE to use? XCode? Or Eclipse with Pydev? I also saw that there is a Netbeans way... For a start, I'd prefer ease of use over flexibility.

    2. Any good tutorials (web or books) for Biopython that is better than the documentation on their web site?

  4. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    1. Any text editor will do. No need for an IDE really. I'd use Smultron myself (in fact I do :)).

    2. The "Learning Python" book you mentioned in your first post is good.

    There are also a couple of good free (legal) online books. This is the one I would recommend though.

    How to think like a computer scientist : Python version
  5. Jeromie macrumors member

    Jan 28, 2005
    For a basic python introduction, check out the book Dive Into Python by Mark Pilgrim. You can buy a print copy, or check out the full text online at Glancing through the biopython documentation, it doesn't look like it will be hard to use once you grasp how python works.

    I haven't tried any IDEs for python, at least for a while. I use Textmate, though other environments would work just as well. If you're already comfortable with another environment, I'd use that.

    Oh, by the way: python is quite good at string manipulation, and it will probably be easier to read other people's code than it would be in perl. I like python a lot; it's my favorite language to work in.
  6. GroovyLinuxGuy macrumors regular


    Apr 2, 2006
    Learning Python is a great book to start with as well as O'Reilly's Programming Python.

    As for an IDE you don't really need one (I do most of my work in GVim for Mac or Linux), but I admit to being kind of partial to IDLE.

    Oh and as an aside have a look at the ipython's kind of interesting and may have some goodies in there for you.

  7. cartooncartoon macrumors newbie

    Oct 17, 2008
    I make my living writing Python.

    As far as learning it, I think the tutorial on the site is a fairly comprehensive introduction. If you've already done software development in another language, it may be a quick read.

    I have the "Programming Python" book from O'Reilly. There are a couple of chapters that may help with getting started. In general, though, I've found it more useful as a reference and as a template for solving common problems.

    One of the best ways to learn Python is to experiment with different syntax. It's easy to do this in Python, since you can run an interactive shell, type in various statements, and see the output right away.

    I disagree with the statements that an editor doesn't matter. Unfortunately, I don't have my new MacBook yet (takes forever to ship), but I'm anxious to check out how Xcode enables Python development. I use a graphical editor on my Linux host (gedit), and I find the syntax highlighting helpful. Especially for someone new to the language, it may be helpful to have keywords, constant values, statements, etc. differentiated with different colors.

    Once you get a grasp of Python and are doing productive things in it, there are two things that you might want to check out. The first is the Python Cookbook. The second is the Python debugger ( The latter is invaluable for finding out what's happening in complex scripts.

    Whatever you do, I would urge you to study up on Python's object-oriented features and use them. A lot of the people I've interviewed who have used Python for research tend to use it as a procedural language. If you do this, you miss a lot of the power and elegance of the language.

    Finally, if you're really into geeking out on Python, you could attend a user group meeting in your area.

    Hope something in this post is useful. :)
  8. pit29 thread starter macrumors 6502a


    May 23, 2006
    The Golden State
    Thank you all... looks like I am on the right way.

    I don't know why I am so IDE attracted - guess that's because I learned programming with Borland's Turbo Pascal, and old habits die slow. And since Eclipse/Pydev has syntax highlighting, I think I'll be going from there instead of using a text editor (knowing that your recommendations also do syntax highlighting) and the shell.

    Again, thanks. Likely that I'll have some more questions soon...
  9. Jeromie macrumors member

    Jan 28, 2005
    Just wanted to clarify something - I do think a good editor makes a difference. But as long as the editor you already uses supports basics like syntax highlighting for python, you'll probably be more productive using what you're familiar with instead of learning a new tool for each language. I'm sure there are exceptions (especially if you're building graphical interfaces), but that's my general rule of thumb (learned from the Pragmatic Programmers).

    If you're entering into programming after a long hiatus, then by all means seek out the tool that works for you.

Share This Page