This site may be down for up to an hour for network maintenance during the period
21 January 2022 22:30 UTC - 22 January 2022 00:30 UTC.

So Tell Me About Python

From The SBN Wiki
Revision as of 13:42, 30 June 2015 by Raugh (talk | contribs) (Creation - Safety Save)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

What is Python?

An informal intro to Python

If IDL is your data analysis tool of choice, you can reasonably think of Python as an open-source alternative. Like IDL, it provides a command-line interpreter that you can use for on-the-fly programming; it is also integrates into IDE environments like Eclipse; there are many reliable user-contributed code libraries you can incorporate into your local installation to reduce your programming time; and there are incompatible differences between major versions that you need to take into account in your coding. Compared to IDL out of the box, though, the core Python language would likely seem rather primitive unless you're a hard-core roll-your-own type of programmer. So if you're planning to do anything non-trivial with Python, you'll want to either look for a download package that either includes the most popular add-ons already in it, or get familiar with how to add packages to the installation you chose.

Wait a minute - What was that version thing?

There are two flavors of Python out there: Python 2 (typically 2.7 or 2.6), and Python 3 (now up to 3.4, I believe). There are some significant and incompatible differences between the two. If you're an interested programmer, this is a good place to leave this page and go do some research. For folks who just want to get on with it, you should merely note that the two major versions are incompatible, and keep track of which version you're using so you don't accidentally install incompatible packages when you're adding to your installation. As of this writing, the PDS4 tools we've got use Python 2.x (because that's what's available locally - we'll port to 3.x eventually), so if you're installing Python specifically to run those tools, go with Python 2.7. If you have a strong feeling about using Python 3.x right now, please let us know.

Downloading and Installing Python

There are many, many different Python packages available both commercially and open source. The definitive source for Python is the Python Software Foundation at Do-it-yourselfers can download the core Python implementation from the download page, read the docs, and start adding additional packages as needed. For those who'd like something more complete, look in the "Download" menu for the "Alternative Implementations" page, which lists pre-packaged sets of Python + modules useful for some specific purpose, and go with one of these. Or browse the web for Python download packages and pick something pretty.