Up: Python

Introduction

slide 001 Hello, and welcome to the first episode of the Software Carpentry lecture on Python. In this episode, we’ll explain why we’re teaching Python, and talk about how it compares with other languages.
slide 002 Whenever you’re programming, the total time to get a solution is determined by:
slide 003 how long it takes to write a program, and
slide 004 how long it takes that program to run.
slide 005 The first is human time: the time to get a correct program running is primarily determined by how fast you can think.
slide 006 The second is machine time: the faster the computer, the faster you’ll have your answer.
slide 007 Every programming language makes a tradeoff between these two kinds of time.
slide 008 High-level languages like Python
slide 009 and MATLAB try to make programming itself faster by doing more for you.
slide 010 Low-level languages like Fortran
slide 011 and C, on the other hand, do less for you, but also hide less from you, which allows for greater optimization.
slide 012 And in between, there are languages like Java
slide 013 and C#, which do some things automatically, but leave others in your hands.
slide 014 So, why have we chosen to use Python?
slide 015 First, teaching you Python isn’t actually the point of this course—what we really want to teach are computational thinking and fundamental computational skills.
slide 016 But we have to write our examples in some language…
slide 017 …and we have found that Python is easier to pick up than other languages which are also:
slide 018 free,
slide 019 run on lots of different machines,
slide 020 widely used,
slide 021 well documented, and
slide 022 well supported: thousands of Python libraries exist, many of them written specifically for scientific applications.
slide 023 Before we get started, please note: this lecture will not teach you basic programming.
slide 024 Instead, we assume you already know at least a little bit about:
slide 025 variables,
slide 026 loops,
slide 027 conditionals (i.e., ‘if’ and ‘else’),
slide 028 lists or arrays, and
slide 029 how to read data from a file.
slide 030 What we’ll do in the next dozen episodes is show you how to do these things in Python.
slide 031 More specifically, how to do them well in Python.
slide 032 So, let’s get started.