Thursday 13 August 2015

I'm into Python

This week has been an interesting week for me, as I have, for the first time in about three years, began to learn the ins and outs of a new programming language.

This language is Python.  I've heard a lot about python, it's use at google, it's use by those who are on the sharp end of internet based development, but whom want to remain serious programmers.

Now, of course, I'm an old style programmer, and I like my code to communicate to me exactly what it's doing, so the first problem I've had with Python is it's use of white space as code flow control.  This is perhaps my biggest bug bare with the language, it totally grates me, and there are ways around it, using perhaps a semi colon to close a class, or an if statement, or simply to indicate that the current stanza/block of code is about to end, rather then using indentation to indicate this.

This particular problem is put into great focus on Python for windows, when loading Idle (the IDE supplied) and it constantly starts to moan about unexpected uses of spaces or indentation... You can literally pull your hair out over this, but that's a bug in that editor not the language.  The language just shows up the problem.

The power of the language though is strong, string editing, numerics, you have a C power straight out of the box, exploring the libraries like urllib and you have extremely simple (2 lines of code) methods to download files from the internet.

Within 200 lines of code I had a working application, which would trawl a website following all the links and listing them.  It's clearly very powerful and not as I had feared a toy language.

One frustration is getting a GUI working, there are perhaps too many options and nothing solid to follow in order to get an interface running.

I'll keep you posted, perhaps I'll come back with some Python code soon enough.

No comments:

Post a Comment