Archive for January 2017


First reactions to Python

January 3rd, 2017 — 5:28pm

After hearing about the python programming language for years, but never using it, I finally hunkered down to do a little testing.  Python is billed as an object oriented language and better than Java (apparently because a “Hello World” program is shorter to write in python – seriously, google it).

I’ve used many languages over the years, but mostly stick with php, perl, and javascript.  So I assumed python would be similar in syntax, and not too hard to pick up.  I went through a few courses over at lynda.com, and was on my way.

 

Waaaay back in 1990, I took a course programming in COBOL.  I recall using graph paper to write programs, because the actual column / indentation of each line mattered to the execution of the code.  Boy, was that tedious!  I was so glad to be done with that language, knowing I’d NEVER have to worry about counting whitespace again.  Imagine my surprise when I found that that in python, rather than using pesky {} braces to clearly indicate the start / end of loops, conditionals, etc., you actually have to make sure each line is indented exactly right!  What?  Oh yes.  Soon you too can get this error, which I have to believe is unique to python:

IndentationError: expected an indented block

Talk about maddening…

Ok, so let’s move on.  My first effort was to build a small web page to pull in data from an open API on the web.  Here are the results:

http://robertswebforge.com/examples/python-fda/index.cgi

Pretty ugly, right?  Having come from using php, I got used to being able to embed html code easily inside a single script.  Surely python, the age of the web, could do something similar…but…ughh..I had to write the dreaded:

print “Content-Type: text/html;charset=utf-8”

which I thought I had abandoned when I stopped using Perl to build web applications.

Now, I realize that there are many modules, frameworks, and libraries that can be used to address some of these shortcomings, and I’m sure it’s a very powerful language, in the hands of an experienced python developer.  I will probably continue to experiment with it, but my initial reaction is…bleh.

 

 

Comments Off on First reactions to Python | Programming

Back to top