{"id":652,"date":"2007-12-14T10:52:57","date_gmt":"2007-12-14T10:52:57","guid":{"rendered":"http:\/\/scienceblogs.com\/gregladen\/2007\/12\/14\/python-its-a-snake-no-its-a-pr\/"},"modified":"2007-12-14T10:52:57","modified_gmt":"2007-12-14T10:52:57","slug":"python-its-a-snake-no-its-a-pr","status":"publish","type":"post","link":"https:\/\/gregladen.com\/blog\/2007\/12\/14\/python-its-a-snake-no-its-a-pr\/","title":{"rendered":"Python:  It&#8217;s a snake.  No, it&#8217;s a programming language.  No, it&#8217;s a snake."},"content":{"rendered":"<p>&#8230; and so on and so on people argue.  But they are both right, it is a snake, and it is a programming language.  I want to talk about the programming language now.  We&#8217;ll deal with the snake another time.   (and boy, do I have snake stories&#8230;.)<!--more-->Python is an interpreted computer language, also known as a script language (being a script language and an interpreted language are not necessarily the same thing, but Python is both).  I never met a computer language I didn&#8217;t like and I also never met a computer language that wasn&#8217;t somehow superior to all other languages according to someone, for some reason.Python is very much like Perl in that both are especially good at handling text, and both have piles of software already written that you can use (as libraries) for handling both bioinformatics requirements and web-related jobs.  (Otherwise, Perl and Python are very different, of course.)The reason I&#8217;m even talking about this, because really, me expressing my opinion about programming languages is nothing but troll bait (and trolls are not in season) is to point out that PLoS has a paper on Python, focusing on it&#8217;s use in bioinformatics.  The paper is <a href=\"http:\/\/compbiol.plosjournals.org\/perlserv\/?request=get-document&#038;doi=10.1371\/journal.pcbi.0030199\">here<\/a>.One thing I think is cool about Python is the way it integrates data entities with control structures.  So, for instance, if you have a sentence in a string called &#8220;S&#8221;:&#8221;Now is the time for all good men to come to the aid of their country&#8221;and you wanted to examine each letter in this sentence to see if it meets a specific criterion, you can do, essentially , this:For each letter in S&#8230;.. do(a thing)and this thing you are doing will loop pretty much automatically across the sentence. (Note: That was not Python code, just pseudocode, to give you the idea)Another especially unique thing about python, which most people say is a great thing but others probably quietly think of as a total pane in the arse, is the way the language is formatted.  White space matters.  Certain code structures must be indented (or not) in relation to each other.  White space is meaningful.  You can make a mistake by not indenting something.This is because Guido thinks your code should be pretty, and Guido thinks indentation is pretty.Guido is Dictator for Life in the Python world. (He invented the language.)Finally, the other thing about Python that is kind of cool is that since it is named after Monte Python, amost everything you read about it uses jokes from Monty Python.  So, for instance, your standard code examples for handling strings in an intro Python book will have you do things like converting:<\/p>\n<blockquote><p>spam<\/p><\/blockquote>\n<p>to<\/p>\n<blockquote><p>spam spam spam spam<\/p><\/blockquote>\n<p>and so on.<\/p>\n<hr>\n<p>Hey was that peer reviewed research I was blogging on?  Not sure.  Anyway, here&#8217;s the ref:A Primer on Python for Life Science Researchers.  Bassi S.  PLoS <em>Computational Biology<\/em> Vol. 3, No. 11, e199 doi:10.1371\/journal.pcbi.0030199<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230; and so on and so on people argue. But they are both right, it is a snake, and it is a programming language. I want to talk about the programming language now. We&#8217;ll deal with the snake another time. (and boy, do I have snake stories&#8230;.)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"1","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[57],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p5fhV1-aw","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts\/652"}],"collection":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/comments?post=652"}],"version-history":[{"count":0,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts\/652\/revisions"}],"wp:attachment":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/media?parent=652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/categories?post=652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/tags?post=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}