Beginning with Python

Whoah, hey, so I’ve begun to learn the language Python. I’m really going into this blind, stumbling about and hoping to muddle my way through. So, of course, I’m going to publicly share the process.

1. What is Python & why are you learning it?

I don’t know, everyone else seemed to be doing it. I mean, it seems to be the basis of Programming Historian, and a lot of digital librarians talk about it. A lot. And if I’ve learned one thing in the digital humanities universe, it’s to always listen to librarians.

My older brother is a programmer, on the other hand, and he doesn’t know Python. He told me to learn Java instead. He then told me to learn both at the same time.

So there you go, mixed reviews. Ultimately, I went with Python and not Java because I have a friend in the econ PhD program at my uni, and apparently they all use Python, so we’re learning it together. So, uh, my reasons are peer pressure and a desire to fit in with librarians and economists.

Anyway, Python is a open-source programming language that is widely used, that is considered high-level (meaning, it seems, that a little does a lot), and that can be used to do many different things. To be honest, I can’t tell you more than that. There is more, but it’s beyond me at the moment. (And this all came, by the way, from the Wikipedia entry for Python).

2. Install, etc.

This is where I kinda muddled through. My brother recommended I use the PyCharm IDE (IDE is an integrated development environment, and it’s basically software that makes programming easier than it would be otherwise by providing editing, debugging, and other things I don’t fully understand at the moment.)

My book, however, recommended getting Notepad++.

Programming Historian recommends Komodo Edit.

What follows, including the screenshots, are of PyCharm.

Also, my econ friend uses a Mac and I use a PC, so I think our experiences diverged as this point. Mainly, his PyCharm seemed to come with Python loaded, whereas I had to download it. But I’m not sure, and it’s always possible he was lying to me. (Is “loaded” the correct term in this context? I’m not sure about that, either. So many questions, so few answers!)

Anyway, having downloaded both PyCharm and Python from their respective websites, I was then able to use Python in Pycharm.

3. Do something

Ok, so I opened PyCharm, started a new project (which I called test1) and chose Python as the interpreter.

I then started a new file under test1, chose Python again, named the file ‘helloworld’, and voila

pycharm1

At this point, I just followed the instructions on the first lesson on setting up an IDE for Python (for Windows) from Programming Historian. Basically a print instruction, so that when you run the program, it prints whatever you tell it to. Like “hello world.”

pycharm2

So I ran the program and

pycharm 3

Hello World! It might not be a lot, but it’s a start.

4. Resources

First off, Python has a beginner’s guide that helped me figure out what I was doing (here). And then they have a beginner’s guide for beginners (read: non-programmers), which is what we want.

Second, Programming Historian. So hard.

I’m also using the book Learn Python the Hard Way, 3rd ed., by Zed A. Shaw. If you follow the link, you’ll see that there is a free online edition of the book. If you like that sort of thing.

Advertisements