Python

python-logo-master-v3-TM

My name is William Mckee. I did a talk in February regarding the Python programming language.

I found Bruce through the New Zealand Python users group mailing list. There had been much discussion in the post regarding getting some Python meetups/classes happen. Auckland, Wellington, and Christchurch have monthly Python meetups. Why not Hamilton? Surely we have more than .net developers? Bruce offered a venue, and I decided to help run them.

I’ve been doing Python for 5 years. Much of my code is rubbish and I have terrible habits (just ask Bruce – he was shocked with my use of terminal command to put jobs in the background rather than close them). Despite the ugly functional code I tend to write in Python my scripts do work and have uses.

As an artist I wanted to write Python scripts that helped me produce art more efficiently. I used the PIL module in order to edit images.

The script opens up random images in a folder, merges them with various effects (screen, difference, darken etc). These are effects that you would normally find in GIMP – but who needs GIMP when you can write your own image editing scripts with Python? I also applied size editing and black bars at the top/bottom.

One of the best and helpful python modules is requests. I use it for downloading websites.  Similar to urllib and urllib2 but far more awesome.

Requests is similar to wget. Get website data. The best data to get is JSON objects. Python can also handle rss and plane old HTML (beautifulsoup4).

With the python module json i can convert a json object to a python dict. Far more friendly. With a dict i can select certain objects and cycle through the list.

Any-site with an api is wonderful and i encourage webmasters to develop a api. It allows people to do cool things with your data. Last.fm is the first 3d party Python api that I go into – this lead in other areas including Twitter, ThePirateBay, and BBC News.

Previously I had setup Unity3d classes on a Sunday so felt I could run some Python classes. We decided on a Wednesday evening for these Python classes.

These classes have been running each week for the past 5 weeks. We have a solid group of 5 or so people that show up each week. I make it very relaxed – people have the choice to sit outside with a laptop or use the computer room.

snapshot2

IPython Notebook – notebook selection menu

 

For teaching Python I have found IPython Notebook to be very helpful. The day of the first class I made a group on GitHub and repo for the Notebook. This was I just get people to make a Notebook and call it their name – each week they can just reopen the notebook and keep working from previous weeks. This also allows me to look through the work people have been producing and offer suggestions and feedback.

If you are interested in learning Python please come along on Wednesday nights from 6pm till 8pm at Te Whare O te Ata Community House.

I’d like to say a big Thank You to Lawrence D’Oliveiro who comes along to the Python classes each week and gives me a great hand teaching others. A wealth of information!

Thank You also to Bruce for helping me getting  started with their classes. You rock.

The GitHub repo – Learn Python

wcmckee github

Lawrance github – ldo

snapshot3

Tagged , , . Bookmark the permalink.

Comments are closed.