London Python Dojo December 2014

I feel like a sub-editor just struggling really hard to avoid punny headlines like “A Unique Experience” and “5 Unique Solutions” and so on… because last night’s challenge was to recreate the Unix “uniq” command in Python. In fact, this was chosen only after a tie in the first round of voting giving us a top 4 rather than a top 3 and a triple-tie for second place in the second round, although with one clear winner. (Otherwise I was going to have to move onto a Single Transferrable Vote round).

It was nice to see quite a few new faces, 6 or so first-timers and several who haven’t been for a while or who have been only once or twice. Plus, of course, the old familiar faces. Fry IT continue to host us generously, including ordering artisan pizzas with enormous slices. And O’Reilly came across as always with a book for the giveaway at the end.

Most teams went for a fairly straight solution, one of them managing to carry a TDD approach pretty much throughout. One team had grander ambitions for field selection and datatype conversion, but their solution ended up on two different machines with not enough time to merge properly. I was a little surprised that no-one used itertools groupby, which is pretty much advertised as a drop-in for uniq.

You can see a few photos retweeted at the @ldnpydojo account. Back again in January, probably on the second Thursday. But watch the python-uk mailing list and @ldnpydojo for announcements.

PyConUK 2014: The Teachers

This is the third time that PyCon UK has organised a track especially for educators: really, for Primary & Secondary teachers, rather than for University lecturers. The first, a couple of years ago, was small, essentially a few hours within the main conference. The second, a whole Saturday last year, suffered from a belief that teachers would be too busy during the week and would prefer to come at the weekend. (In fact it seems they’re happy to get a day out from school on legitimate business such as learning about Python). This year we had upwards of thirty for the whole of Friday, students as well as experienced teachers.

You can read about some of the activities on offer and what they got out of them on their blogs and elsewhere. What I want to talk about is what I got out of it. I don’t think I learned anything absolutely new, but certain things were brought home to me more clearly.
I think that, as hackers (in Eric Raymond’s sense of that word), we expect teachers and pupils alike to be on fire with enthusiasm for programming, agog to learn more and to advance in this amazing world, and skilful enough to appreciate the subtle nuances and elegant constructs of the Python idiom. And we expect their schools to be 100% behind them, facilitating their initiatives, and supporting their ideas for learning in the 21st Century.

There surely are such people and institutions out there. But the picture painted by the teachers at PyCon UK was quite different. IT Administrators – whether school or county – can be restrictive in the extreme: disallowing access to the command prompt, enforcing bureaucratic processes for installing new packages, and limiting network access. At the same time, pupils may not be the excited and engaged proto-hackers you might have hoped for; they may have real difficulties with even the simplest of programming concepts. And the teachers are … teachers: people whose daily life is spent charting a course through the administrivia of modern-day schools, managing classrooms full of underappreciative pupils, and struggling to master for themselves some of the concepts they want to pass on to their pupils.

Like many in my situation, I started programming when I was 12, initially on my engineer Father’s programmable HP calculator and then, like so many others, on a BBC B. And I genuinely can’t remember a time when programming wasn’t intuitive. Of course, I’ve learnt and improved over the years. Of course there were things I didn’t understand; there still are. But the basic ideas of programming have always come easily. And I can find it a real challenge to put across concepts which are so very basic and whose explanation you’ve never needed to people to whom they don’t come naturally: to do the job of a teacher, in fact.

But that’s what each of us had to do for most of the teachers at PyCon UK and that’s what they have to do for most of their pupils. Even those teachers who have some experience in programming can struggle to visualise the solution to a more complex problem. To make matters worse, Computing is one of those subjects – like Music, perhaps – where a small number of the pupils can be streets ahead of the rest of the class. And maybe of the teacher.

On the Friday afternoon, after a morning of workshops, we had a Dojo-like session where teachers called out ideas for projects they’d be interested in pursuing with help from developers, and we developers attached ourselves to a group to offer advice. The group I joined was somewhat decided for me as one of the teachers was asking for help with an A2 project involving using a relational database to produce a simple room-booking website– and since my day job involves relational databases, I was pushed to the front to help a group of eight or so teachers.

In the discussion which followed, it became clear that, not only were many of the group of teachers hazy on the ideas of relational databases, but also of dynamic websites, plus the pieces of Python needed to pull those together. Another developer helpfully jumped in to propose Django, which brings us to the point I started to make above. Django has a good tutorial with a useful get-you-started admin mode, is well-documented, and has a strong and helpful community. But it requires a big level of buy-in from the pupils and, especially, from the teacher who will have to be able to help them.

“But there are forums,” you cry, “and mailing lists, and stackoverflow answers, and books, and lots of documentation”. And there are. But I was talking to teachers who have to fit a project like this into the structure of perhaps one or two classes a week plus homework among everything else. And something like Django is a big overhead. “But it’s easy!” It‘s not bad , if you already know what you’re talking about, or have unlimited time to play around and throw projects away. But, for this small project alone, I was having to pull together a headline course on relational databases and your possibilities using Python, with or without non-stdlib modules , plus the same thing for web programming, plus all the Python bits to make it all work. It was humbling to realise how many obstacles a teacher has to overcome to fulfil even the basics of the current computing curriculum.

As a proof-of-concept, I jotted down some notes on the spot, and ran up a couple of modules using sqlite and bottle (since it’s a one-file import which makes it easier to smuggle past restrictive installation régimes). The results are on my github.

During the Sprints on Monday (and on the way home) I decided to take it further, and to dust off an idea I had last year and which I hadn’t really pursued: One Screenful of Python. In last year’s Education track, I’d understood that one screenful of code was about right for one classroom session. So my idea was to produce useful, engaging, readable, snippets of Python which would fit, roughly, onto one screen and would produce an interesting result and illustrate some useful points of the Python idiom or of programming in general. It’s hosted in a github organisation.

It was quite clear that the project of building a website for room bookings using a relational database wasn’t going to fit on one screen even with some code gymnastics, which would in any case have defeated the pedagogical purpose of the exercise. So I restarted and produced a one-module project, built up over 13 steps, each building on the last (so a code-diff tool will produce a useful comparison). The result is in its own repo within the One Screenful organisation.

The code should run unchanged on 2.7 and 3.x; it should run cross-platform, especially targetting Windows & Raspberry Pi as they’re most likely to be found in the classroom; and it should work with the stdlib alone. These restrictions are an attempt to reduce possible difficulties teachers might face in getting it up and running. Sticking to the stdlib obviously precludes handy tools like Bottle (or your other lightweight web framework of choice), SqlAlchemy (or your ORM of choice) and whatever else might be useful. But it does simplify things. (pip install on Python 2.7 on Windows anyone ?).

But the most difficult restriction was in writing code which would be understood by A-level students. I’d struggled valiantly to pull back my hand and write simpler code. And then a teacher who kindly gave me feedback said that she thought the more able among her pupils might be able to cope with the code! This is the nub of the issue: the pupils who are gifted in this area can head off into the distance and work up full-stack Django apps from the online documentation and StackOverflow questions. But the run-of-the-mill average students need things to be kept simple to get them started.

If I have the time I’ll probably do a Git branch which will rework the final codebase in terms of, say, Bottle and SqlAlchemy. I don’t say that learners shouldn’t know about these things: they certainly should. I just think that every tool you add to a stack, no matter how useful, adds complexity. And if someone is a beginner, it might be better to stick to standard stuff. (I recognise that this is not a very strong argument since the code needed to manipulate SQL without an ORM is relatively verbose; likewise, using the built-in WSGI support). I also considered an approach of using git tags rather than the separate directories for the progressive disclosure of of the codebase. But, although it’s a neat idea, it’s an additional complication to cope with in the classroom.

So what did I get out of the Education Track? Well: that what many teachers need is simple code, easily installed, runnable without complications on different platforms. I’d like to be able to help, but I have commitments of my own which prevent me from easily giving much time to direct help in a classroom. But providing suitable code and advice is something I can do.

PyCon UK 2014: The Happening

Someone I meet only in Coventry mentioned in the hallway in this year’s PyCon UK that I’d not written about anything this year which he could comment on when he met me there. And indeed I was surprised to realise that my last post on this blog was about last year’s PyCon UK! I know I’d had several ideas for what to blog about, but clearly those ideas never became a reality.

As I pointed out in that year-ago post, every PyCon UK charts its own course for me each year. This year I was heavily involved in the Education & Kids’ tracks across the road in the Simulation Centre. In fact, apart from quick visits to the dining hall for food, I hardly interacted with the main conference at all throughout Friday and Saturday. As I tweeted at the time, the first talk I attended at the conference proper was the one I was giving first thing on Sunday morning!

Others have already done so, but I’d like to give tons of credit to Nicholas Tollervey who organised and ran the Education and Kids’ track (as well as giving a talk at the conference proper on turning footfall data into music). This involved liaising with schools and teachers for over 30 teachers to be able to attend PyCon UK as part of their Professional Development, in some cases assisted by money (generously provided by the Bank of America) to help pay for classroom cover. The Bank of America also paid for the venue, while the Python Software Foundation provided money to cover travel & accommodation. And then there’s the job of organising for 70 kids to come and have some experience of programming in a supportive environment. Those who only know Nicholas as a developer and organiser-in-chief of the monthly London Python Code Dojo may not be aware that he was a professional tuba player and, significantly here, a Secondary School teacher. This (I assume) gives him an insight into what will give the most benefit to the teachers and youngsters attending.

I hope to write a separate blog post on the Education slice of the conference on Friday. (If only to ensure that I have at least two blog posts to my name this year!). The Saturday event for children was certainly well-attended. We were over there not long after 7am setting up chairs, tables, RPis, keyboards, mice, screens and a *lot* of power cables to keep 70 youngsters occupied. Because of the numbers, activities were split over two large rooms plus two smaller rooms for specific activities. There were guided sessions on Minecraft, using the Pi camera module, and using PyGame plus a fair amount of freeflow action, mostly involving Minecraft. At the end was a show-and-tell where at least some of the various projects were showcased.

The Raspberry Pi Foundation Educational Outreach Team (or whatever they’re called) were there on both days, and in fact throughout the conference including the sprints on Monday. As well as running workshops in the Education track, they also provided a Model B+ Raspberry Pi for each of the youngsters attending, and gave talks and keynotes speeches at the main conference.

I attended relatively few of the talks at the main conference. I did like the team’s presentation on their approach to using Flask to implement wizard-style forms (a project codenamed “Gandalf” apparently!) and which they hope to be able to open-source. The lightning talks I did get to see (ably compered as usual by Lightning Talk Man) were interesting; and one of them was even using my active_directory module. Another blog post from me in the making there, I hope.

The one very obvious aspect of the PyCon UK this year was the numbers. And, as a result, the queues, especially in the dining hall. Even my own talk – on the fairly niche subject of Core Python Development on Windows – was fully attended, presumably as a result of refugees who couldn’t fit into other talks and were desperate for somewhere they could at least sit down. It’s nice problem to have: to be too popular; but I imagine the organisers are looking hard at arrangements for next year.

I stayed for the sprints on Monday and so was looking for somewhere to eat on Sunday evening, traditionally the least organised of the PyCon UK evenings. I went looking with Conor & Ben for somewhere to eat in Coventry on a Sunday evening. With limited success. (We did eventually find somewhere open). I spent a pleasantly quiet rest of the evening with a pot of tea in the hotel bar, and chatting to Giacomo about this and that.

Monday was sprints, and although I was available to help people get started on core dev work, I was actually sprinting on my own Screenful of Python idea, of which more in a later post.

PyConUK 2013

Every PyConUK has a different feel to it. By which I mean: I chart a different course through the weekend each year. Of course, the specifics of the conference itself change each time, too: the talks being given, the rooms being used, the people there, the special events or tracks being offered; all those things affect the feel of things too. But, as the ever energetic Zeth (”Really I should call this ZethConUK”) pointed out at one of the several opening addresses: this is a community conference; it is what you make it.

This year I’d committed to being a session chair for an hour and a half in one room on the Friday afternoon. Being a session chair means you’re going to be listening to three sessions, whether or not you’re inherently interested in the subject matter. In my case matters were made more interesting by a misunderstanding by one of the speakers who mistakenly took another speaker’s slot. At the exact same time that the Wiki was out of action after over-zealously shutting down when detecting an IP-bomb. (ie all the people at PyConUK on the *same* Nat-ted address all trying to access the schedule at the self-same time). This meant that I couldn’t check the timetable and I had to believe the quite-certain speaker’s version of events. The thing was resolved amicably and we moved on.

My own talk had been in the very first slot of the Fri afternoon sessions and nobody walked out or evidently fell asleep so I’m willing to judge it successful on that basis!

Following on from last year’s “Teachers’ Track”, the indefatigable @ntoll [actually: very fatigable as we saw on Monday] had organised both an education track on Saturday and a Raspberry Jam on Sunday, assisted in the latter by “Mr Raspberry Jam” himself: Alan O’Donohoe. There are pictures and videos of both around the web, for example here and here.

This year we had bigger rooms, which worked for me. I slightly missed the Tweetstream which used to be projected in the [this year’s] “HP Room” but Twitter traffic didn’t seem that great when I checked so maybe the Twitter-buzz is tailing off, or at least plateau-ing.

As always, the chance to meet people, the evening meals and drinks, looking around historic Coventry, all the not-conference things add to the occasion. The Ibis hotel is perfectly pleasant and reasonably priced (and effectively on-campus for the conference). The staff at the Technology Centre are helpful and friendly and competent; several times this and previous years I’ve witnessed the dining room staff go out of their way to try to accommodate someone’s needs even when, for whatever reason, they haven’t been given advanced notice.

My particular take-home idea from talking to teachers at the Education track was the idea of “One Screenful of Python”. I’ve started a Github organisation but I haven’t yet fleshed the thing out fully. The basic idea is that programmers would like to contribute to helping teachers out, but don’t necessarily have the time or flexibility to go into schools directly. But teachers would be helped by having a self-contained piece Python code which does something interesting. A screenful is the right size to put in front of a class and go through in the course of one lesson. Don’t know if it’ll come to anything, but it’s worth a try.

Anyway, big thanks as always to John Pinner and the PyWM team and everyone else who helped. (Hat-tip here to Peter Inglesby who very ably coordinated speakers and session chairs). I enjoyed it and I look forward to next year.

PS There are links to write-ups and photos over on the wiki.

The BAML-Sponsored PyConUK 2013 Raspberry Jam in Coventry

An unwieldy title for a great event.

Everything came together on Sunday at this year’s PyConUK in the TechnoCentre in Coventry for the 3rd year running. We were lucky enough to get Bank of America to sponsor a Raspberry Jam and lucky enough that Alan “Jambassador” O’Donohoe was around to lend his manic energy and unique style.

Despite the relatively short notice we were able to give, we had 25 youngsters plus their parents helped by as many Python developers from the main Conference plus some of the teachers who’d come for Saturday’s Education Track. I’ll link to some of the photos that were taken when they’re posted up. But it’ll be clear to you just how much manic energy was involved and how much youthful mayhem was harnessed.

We had people bringing robots and Python-controlled helicopters; we had children bringing Minecraft-inspired ideas and wackiness; we had people controlling LEDs; we had Scratch and Minecraft and pure Python; some people brought their own Raspberry Pi’s and other people used the ones we’d supplied; some of the parents caught the bug and were coding along with their kids; sometimes it was the other way round.

At the end, a group of three girls (and we had probably a 50-50 mix) went over to present a Lightning Talk to the main conference itself, showcasing their Minecraft-powered UFO.

Overall I think we can count our first foray into Raspberry Jamminess an success. We’re tremendously grateful to Bank of America whose sponsorship enabled us to use the excellent Simulation building as a completely separate space for what was, in effect, a subconference. I hope that it’s inspired people to run their own version of a Raspberry Jam, and that it’s given kids and their parents a flavour of what you can do with a little creativity.

UPDATE: There are photos here