I’m learning Python

May 31st, 2008

Google opened up App Engine to all developers this week, so I decided it was an ideal time to check out Python.

This was something I’ve avoided until now for a few reasons; primarily because I didn’t have the time to learn a new language, but also because I thought I wouldn’t like the semantics and philosophy of Python. I’m certainly more enamoured with the language now, but there still some ideas I’m not totally sold on just yet.

Semantics

Python has a really clean coding style (it’s even tidier than Ruby). For example, a simple class definition looks like this:

class MyClass:
	aString = ''	# public variable
	__anInteger = 0	# private variable

	def __init(self):	# constructor(-ish) method
		pass

	def Hello(self):	# class method
		return 'Hello, World!'

As you can see, Python uses indentation as opposed to braces in C-style languages, or start/end blocks in Ruby. I wasn’t keen on this before, but after playing around with it for a week or so I think I like it. I still don’t think it makes the code that much simpler to read, but it certainly makes coding a lot faster.

Philosophy

There does seem to be one overriding philosophy evident in Python’s design: there are few rules, but many conventions. For example, private variables and class methods are not really private, just obscured. I don’t understand why this is the case: if a method is private, it’s private for a reason, there should be no cause to allow a developer to have access to it. Annoyingly, Python also doesn’t allow for protected members. Python has special __init__ methods instead of constructors (for all intents and purposes, they operate the same way) and no destructors. Otherwise, it behaves pretty much like you’d expect an interpreted, modern programming language to operate (aside from, of course, the aforementioned private members idiocy).

The Standard Library

So, Python as a language isn’t really ground-breaking. What sets it apart from the rest is it’s fantastic standard library (and also it’s adaptability; Python can be shaped to suit almost any task). The developers like to say that Python ships with ‘batteries included’; it’s an apt analogy. I won’t go into detail regarding the standard library (because it’s simply too exhausting to discuss it thoroughly), but if you want to know more it’s very well documented at python.org.

Learning Python

Learning Python is exceptionally easy to learn if you’ve ever programmed before., it really is a testament to the language’s simplicity. There are hundreds of tutorials on the web and elsewhere that will get you started, but I’d point you towards the free (cc licensed) book available diveintopython.org. You can download it or view it online, or even order a printed copy from Apress if you want to support the author.

Half of Ireland is computer illiterate

May 17th, 2008

Silicon Republic has an article about the widespread computer illiteracy among the older Irish generations.

Nearly half the country has virtually no computer skills whatsoever, citing every day examples of parents asking their offspring to conduct routine tasks on the Internet, such as booking flights and hotels and checking weather reports.
“The divide between technology savvy individuals and those in the other 50pc of the population is huge,” commented Liam McMahon, managing director, New Horizons Ireland. “The reasons are manifold as to why some people are being left out of the technology age; lack of education, lack of previous interest and lack of time are just a few.

Read the full article here.

Grand Theft Auto Skit By Dave Chappelle

May 11th, 2008

Enough: I don’t have a zip code

May 4th, 2008

Ireland doesn’t have zip codes (per se: Dublin has postal codes, but they’re not strictly analogous to zip codes). Almost all the time, this is not a problem. Ireland is small enough to get by without needing such a system, and so has avoided introducing one so far.

This is going to change; Eamon Ryan plans to introduce an national postal code system by 2009 (whether on not this is actually going to happen is debatable; proposed changes on this subject have died before).

But in the meantime, Irishmen continually have to suffer the regular annoyance of being prompted constantly for out not-existent zip code. Usually, it’s not so bad; entering a random string generally gets you by. Other sites, in the name of rock-solid input validation, check the validity of said entry and reject any code deemed non-existent.

Now, normally I applaud thorough input validation (I especially like it when sites check the top level domain of an email-address to ensure its existence); but if you’re going to insist on a valid zip code, it’s important to understand that postal coding is not a universal policy.

Google Maps for Liberty City

May 1st, 2008

Capture IGN and Google have mapped Liberty City, featured in the just-released GTA4. Places of interested are already cropping up, thanks to the community. This is just another reason in the list of many testifying to the sheer brilliance of Google Maps.