A delayed summary of Python Ireland's February meet-up last Wednesday -- another great event, after which I promptly fell sick (getting ready to kick ass again now though :)). In January, the group had a simple and nice "pub meet-up", where a few Python beginners and novices turned up (including one who's now my student *waves*), and it was thus decided it would be good to have some introductory talks in the following months. Hence February's first talk:
Introduction to Python
In this talk, Sean gave a quick introduction to Python by comparing it with other programming languages ; namely C, Java and Ruby.
I must say I took notes in preparation for my crash course later on :o) Nice ideas on how to present a new language to programmers. The comparison wasn't only on the syntax or verbosity, and general programming paradigms espoused by the languages but also on the different cultures encouraged by their respective community. Very interesting! Though unfortunately, probably difficult to follow for beginners new to programming, of which there was at least 1 in the room -- but it's difficult (impossible) to create a talk that caters to everyone in the whole world.
Somehow post-talk questions mostly resolved around high performance parallel programming :)
Advanced unit testing
Rory enthusiastically introduced us to the latest additions in the unit test framework for Python 2.7 (backported from 3.x into unittest2), and after this talk I can't wait to enthusiastically switch my programs to Python 2.7. Exciting stuff. For instance...
- more Asserts! With cool names, like assertAlmostEquals ;) assertMultiLineEquals sounds fairly cool too, it gives you a diff as opposed to the whole strings that didn't match.
- when you have a slow setUp() or you simply do reads without writes... I introduce setUpClass()! Yes! There's even a setUpModule if all the tests for your module share a setup step. Of course the same exist for tearDown().
- "discover" will find and run your tests without you having to add the __main__ stanza to all your test files, yay. It works like this:
python -m unittest discover -s [path]
You can specify a class or function if you like.
The rest of the talk was about mocks. Mocks. Mocks. They're not in the main unit test framework and voidspace's seems to be the recommended library. It was interesting to see how they're used. Mock patch enables doing all the mocking stuff with fancy decorators, thus avoiding you the pain of manually storing and restoring the original value of something before you replace it with a mock. Overall veeery interesting.
AGM & Pub
A short and sweet AGM followed where the committee ended up re-elected (go committee, y'all rock!). We then moved on to the pub where general Python and other techie discussions happily prevailed for the rest of the evening.