Python

I’m teaching myself how to program in python. It’s very slow going. Some of the syntax is similar to C, but it’s object oriented and I can’t seem to wrap my mind around what that means. Shit happens in a different order than in old-school programming, and I keep mixing up all the vocabulary words. When I think about code, I declare a bunch of variables, and then I do shit to them. Like add them, or sets of more complicated operations which (if I’m ambitious) I code into subroutines. Just like I think of basic English sentences as being “subject-verb-object”, I think of simple code as being newVariable = function (oldVariable). But with object oriented, sometimes you do stuff like oldVariable.action, and oldVariable just changes itself into modifiedOldVariable.

Working definitions I am devising:

  • module: a .py file (for python). It might contain one or more class definitions, but it might just have some code
  • class: defining a set of operations/function/actions that can happen to an “object”
  • object: an “instance” of a class. That is, some “thing” that can be acted on by all the functions defined in it’s class. It has all the “properties” of the class.
  • method: one of those operations/function/actions that was defined in the class. Functionally (heh) these are little functions (def blah blah) in the classmodule file. HA.

The other thing that’s making it really hard to learn python is that I’m simultaneously trying to learn how to be a better programmer, and I’m trapping myself in a kind of “best is the enemy of better” loop. I’m so paralyzed by trying to Do It All Right From The First Step that I wind up not taking any steps at all! Maybe I could just attack this second goal piecemeal? Improve one step of my process, such as implementing version control (currently working on this. Post to come). Once that habit is less painful and awkward, I could move onto another step.

But I’m in that low, icky elbow of the learning curve where my “research” to “output” ratio is very irritating. An hour of reading python references to produce 3 lines of code, because I have to look up the syntax (How do I access the nth element of an array? Oh, this isn’t an array, it’s a “dictionary-like-object”. How the fuck do I access something in a dictionary-like-object? I’ll try the dictionary-accessing syntax, which I also need to go look up. Oh, look, it’s lunchtime!) The whole thing is just exhausting.

I just ordered 5 books (4 on python and one on how to be a programmer). I always go a little overboard, but having a couple of actual books can sometimes be faster for me than googling for 20 minutes. I debated over buying ebooks (searchable!), but I haven’t successfully transitioned to ebooks for reference material, and there’s plenty of free stuff out there on the web. I think part of my inefficiency is there’s TOO MUCH stuff out there, and I google, then look at 10 different webpages, and wind up wasting a lot more time than if I just turned to a book that I’d taken the time to index in my head and get accustomed to the style of. I find if hard to discipline myself on the internet–I can’t seem to commit to just one reference source (and do that same internal indexing I do with well-loved reference books), so I keep being inefficient.

 

Advertisements
Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: