Python Programming, news on the Voidspace Python Projects and all things techie.
PyCon the Road Trip
This has been our first visit to the US for both Andrzej and I. We had the difficult choice of participating in the sprints, or making an attempt to explore something of America.
We opted for the latter, and on Tuesday we went for a road trip through three states.
We started the day in Dallas Texas. In England the weather is cold and horrible. Here it feels like summer.
We drove North to McAllister in Oklahoma (farming country), about three hours drive from Dallas.
We then turned east, to the Ouachita Mountains of Southeast Oklahoma. These are really big hills rather than mountains, but they're pretty big and some very beautiful countryside.
After driving over the forty miles ridge of the Ouachita Mountains we found ourselves in Arkansas. It was then about 6.30pm and darkness was falling. We saw several deer on the drive down from the hills and then drove from Arkansas back to Dallas. We got back to the Dallas Addison Marriott hotel just before midnight, after around 400 miles and twelve hours on the road.
Mind Blown by PyCon
The dust is beginning to settle, and PyCon is truly over. In fact Andrzej and I are still in the US visiting some folk I lived next door to ten years ago, who now live near Houston.
The talks were great, but by far the most mind-blowing experience for me has been meeting so many cool, fun and interesting people.
I've also got to chat with (if only briefly sometimes) with some of the smart Python folk who I've looked up to for a long time. In fact I've met a lot of really amazing folk. Some of the notable ones include Brett Cannon, Ian Bicking, Jack Diederich, David Beazley, Andrew Kuchling, David Goodger, Jeremy Hylton, Steven Bethard, Bruce Eckel, the Wingware guys and a whole host of great folk way too numerous to list. I even said hello to Anna Ravenscroft .
There were two highlights of our time in Dallas. The first was getting to spend some time with Seo and the Microsoft guys who came to the conference. On Saturday night Andrzej and I went to dinner with Jim Hugunin (who showed a slide of my blog in his talk, yay!), Dino Viehland (who does a lot of the heavy lifting in the IronPython project), Mahesh Prakriya (IronPython for ASP honcho) and Seo Sanghyeon (the FePy guy from Korea).
It was great fun, and Jim has some great ideas for the future of IronPython and the community.
(From left to right: Dino, Jim, Seo, Mahesh, me (looking very odd), Andrzej)
Mahesh did a lightning talk on IronPython and ASP.NET. He put in a proposal to do a full talk on it, but due to the number of presentations it wasn't one of the ones that got through. This is a bit sad, I don't think many people in the Python community appreciate quite how massive ASP.NET is. Think Python web developers plus rails developers and then multiplied a few times (possibly quite a few times)...
Seo pointed us to a new Japanese book on IronPython that is already available for pre-order on Amazon: Django,TurboGears,Twisted,IronPython. Seo reckons these guys have got Django running on IronPython, using embedded ASP.NET controls! Some of the ASP controls are very cool, like the data-bound grid that Mahesh was showing off in the lightning talk.
Mahesh also showed Andrzej and I a quick demo of using the InkControl with IronPython and a tablet PC. In about 15 lines of Python (with a bit of help from .NET 3.0) you can draw on a form, have the PC do hand-writing recognition on what you've written and then use speech synthesis to say it to you. It makes a very impressive demo.
On the Sunday evening Andrzej and I went out for a meal with some of the Python-Dev crew and a collection of googlers . It was organised by Jeremy Hylton: many thanks, it was a great evening. By a quirk of fate I ended up sitting between Guido and Jeremy, gulp.
Andrzej and Steven Bethard.
Brett Cannon and Thomas Wouters.
Guido himself. More pictures of the evening here.
After I'd recovered from the shock, the meal was great (and way too posh - but thanks google). Guido was asking about IronPython. He kind of assumed that using the .NET framework from IronPython would result in unpythonic code. In fact using the framework classes directly is not bad. You generally configure them by setting properties, so Windows Forms in particular does feel Pythonic. The .NET framework is very fond of using enumerations for configuration, where we would probably just use short strings, but other than that it's very good.
Getting to meet people you have only communicated with electronically is an odd experience. I had a great chat with Michael Hudson during the meal. I had always assumed he was a middle aged American dude. It turns out that he is younger than me and lives in Bristol...
In fact what is amazing is how low the average age of the Python core developers is (Jeremy, Barry and Guido excluded of course).
It seems that even in a company like google, the American culture is to give employees much less holiday than in Europe. Maybe I won't be planning my move to the US quite so quickly...
My favourite quote from the conference was from Jack Diederich: he is more interesting than he seems from his blog.
|||About 95% of the conference attendees were male. That's hardly surprising, but it was encouraging to see some women there. It would great to get more involved of course.|
|||Meaning employees, not just users.|
Python 3.0, IronPython 3.0, Robots, Talks and Python in Interesting Places
As you might expect, PyCon (593 total attendees) has been an awesome and mind-blowing experience. The most incredible thing has been the huge number of cool and interesting people that I've met. More about that in another post.
Every talk had a profusion of laptops in evidence, mainly Macs or Linux. The picture above shows Python geeks in their natural habitat.
The two really outstanding talks have been the two keynotes that I got to. I've already blogged about the OLPC project, and their vision to put Python in front of 100 million children. Needless to say, the other amazing keynote was Guido's talk on Python 3000. Python is headed in a great direction, and I have no real fears about the arrival of Python 3000. The major changes include :
- Classic classes go bye-bye
- True division switched on (use // for integer division)
- print as a function 
- The new I/O layer
- All strings to be Unicode and a new bytes type
- Changes to dictionary methods keys, values and items to return 'dict views' rather than lists
- Improved try: ... except: syntax (including __traceback__ attribute on exception instances - the changes here are very cool)
- Syntax for attributes on functions (a useful tool for documentation or a way of adding optional type checking or transformation when used in conjunction with a decorator)
- Possible abstract base classes for different 'classes of types' 
A lot of these changes are going to appear in Python 2.6 or have a future import to switch them on.
The timetable for the changes is going to be (subject to random and bizarre changes) :
- April 2007 - 3.0 PEPs and features accepted/decided
- June 2007 - 3.0a1 - basic (most) features implemented
- Dec 2007 - 2.6a1
- Apr 2008 - 2.6 final
- July 2008 - 3.0 final
The 2to3 migration tool looks pretty good and there are lots of language cleanups coming in Python 3. (Sorry William, map and reduce have gone, but at least lambda is staying.)
Another great talk was the Jim Hugunin one, his 'IronPython state of the union' address.
He talked about the future of IronPython. Version 1.1 will be coming out in April, with more support for the Python built-in modules (currently IronPython has 27 of the 54 built-in modules that CPython has). Version 2.0 (due early 2008) will hopefully support Python 2.5, and as well as architectural changes (better performance, yay!) should support yet more Python standard library modules with a raft more bug-fixes.
Importantly, Python 3.0 was up on the list. The IronPython team is definitely intending to support Python 3.0.
He also showed a couple of novel uses of IronPython. First of all he demoed a simple 3D space rocket game with asteroids that was written in IronPython and using the XNA game framework. The 3d model was pretty detailed and moved very smoothly, all scripted with IronPython. Unfortunately, the XBox 360 (which also uses XNA) is built on the compact edition of .NET. This lacks the runtime code generation 'stuff' (System.Reflection I guess) which IronPython needs. IronPython on the 360 would be cool, both for hobbyists and games developers, so the IronPython team are pushing the .NET people to make this happen. This is great news, because when it happens IronPython will run on Windows Mobile devices.
The second demo was using the Microsoft Robotics Studio. IronPython is one of the supported languages for the Robotics Studio. Jim says that part of the vision of the robotics studio is to provide a common interface and programming system for a wide range of different robotics devices (whereas currently there are as many programming interfaces as their are robots) . He illustrated this part of the talk with a robot, which had everyone out of their seats.
This has been a bit of a theme at PyCon for me: learning about some of the interesting and exciting places that Python is getting used. Sony Imageworks make massive use of Python in their CGI rendering system, controlling the rendering pipeline. I sat next to a guy from Seagate in one talk; they use Python for all their hard drive testing.
Other talks I've particularly enjoyed included the ones on IPython and the two on eggs. I've played with IPython before, and now feel like I know enough to make good use of it, I also feel a lot better equipped to use and distribute eggs.
|||At last their might be a way to tell the difference between custom sequence and mapping type objects. Have your class inherit from the appropriate abstract base class. (A 'soft' version of interfaces for type checking: which is sometimes a necessary evil.)|
|||Further, he says that Bill Gates thinks that robots now are in about the same position as computers were in the 1970s. Crude toy devices available for the home, expensive devices used in industry, and the whole scene ready for a revolution...|
IronPython Talk and Tabbed Images
Andrzej and I have now completed our talk on "Developing with IronPython & Windows Forms". It went ok, no major screw-ups (even though we had a live example at the interactive interpreter). W00t! 
We had some good questions, and I think the example application went down well. The talk was videoed, so hopefully there will be a video up and available soon. We had about sixty people (around 56 more than we expected), which was 10% of the whole conference - or fifty percent of the people who were up that early in the morning...
What I should have done is focused on a few more compelling reasons as to why Python developers might be interested in Windows Forms. One of the main ones is that Windows Forms is an incredibly rich GUI toolkit. There are a lot of very slick and powerful controls in Windows Forms, plus a massive amount of third party controls and tools available. Perhaps we should have demoed a more sophisticated control like a data-bound grid.
Anyway, back to our example application.
I've just done a new release :
Andrzej has added a new drag and drop feature, and the window starts off with a better size and in the centre of the screen.
Andrzej has also added some tests . This is great. He says on his blog that he added the tests because writing tests is part of his 'design process', and so to add the new feature he had to write the tests first!
Tabbed Image Viewer is a cool little program. The 'auto-paste from clipboard' feature makes it perfect for screenshots (using ALT-PrintScreen). Andrzej will continue to develop the app, so stay tuned.
More posts about PyCon to follow (oh, and I will also post a longer version of our talk)...
|||To quote my colleague William.|
|||The tests use unittest, so you will need the Python 2.4 standard library path in IRONPYTHONPATH to run them.|
Short Version of IronPython Talk Online
Andrzej and I have been working on our talk. We've cut it down a bit to make sure that we have time for questions afterwards.
At some point (soon) I'll put the longer version online as well. It has a lot more notes and is a pretty good introduction and reference on starting with Windows Forms.
Andrzej and I went to the Dabo talk this afternoon. The presentation was great (Dabo is very impressive). Seeing all the naked wxPython code was a reminder of how nice the Windows Forms API really is. The Dabo guys have done a lot of work abstracting away the wxPython inconsistencies and complexities; and the result is something that feels not that different from Windows Forms.
The Dabo guys also had an example image viewer to go along with their talk (it does a bit more than ours). One feature of their's was drag and drop - you could drop an image on it to view it.
Andrzej wanted this: so he's adding it to subversion (along with some functional and unit tests). He's typing furiously as I speak. When he's finished I'll do a new release.
If you're at PyCon and thinking of coming to our talk (Sunday morning, in the Mesquite) then Tabbed Images is worth downloading and having a play. It is a little program we've written to accompany the talk. Tabbed Images is quite short, and the idea is that you can pull apart the source code and see how we use the different controls and events.
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.