Dave Beazley is no stranger to PyCon. He’s been attending them since the beginning, including a few last-minute road trips, the ones close to home in Chicago, and all the ones in between. Throughout the years he’s given several mind blowing talks, followed up some of those talks with equally mind blowing open spaces. He has presented before the entire audience on the plenary stage, and has brought his educational skills on the road for numerous tutorial sessions.
For PyCon 2013 he’s running two great tutorials: Wednesday afternoon’s “Learn Python Through Public Data Hacking”, and Thursday afternoon’s “Python 3 Metaprogramming.” The first aims to introduce Python to complete beginners, and the second aims to fill the advanced user’s tool belt with some of the shiny new features of Python 3. He’s also sponsoring this year’s conference, a first for Dabeaz, LLC.
For the Beginner
When it comes to the Learn Python tutorial, the emphasis really is on the first two words: Learn Python. “It's a tutorial for complete beginners, but with a completely different focus than what you normally see,” he states. “For example, instead of having students write a one-line ‘hello world’ program, I'll start out by having them write a six-line program that tells them when the next city bus will drive by my office,” speaking of his Clark Street office on the north side of Chicago.
The approach gets away from the standard examples like fibonacci, instead showing off Python’s power right out of the gate. The students then learn that they can leverage other civic datasets on crime and buildings to create interesting mashups.
One of Dave’s more interesting mashups involved a correlation between the City of Chicago’s rat and rodent baiting database and available FourSquare checkins on Twitter. “Both sets of data included geographic coordinates so the program would watch Twitter for people checking into places, pull the coordinates, and check the rodent database to see if any nearby rats had been recently reported,” he explains. “If so, a special Twitter ‘rat’ account would reply with a simple ‘squeak’ message and nothing else. Silly stuff to be sure.”
“The thing I like about these kinds of examples is that they are real-world, yet something that everyone can relate to in their day-to-day life,” says Beazley. Hopefully none of you got the “squeak” reply on Twitter, though.
On top of learning the Python language, attendees will get their hands on the Pandas library as well as IPython’s notebook feature. “In my opinion, IPython notebook and Pandas might be the two most exciting Python projects going right now,” he enthusiastically stated.
Building Tomorrow’s Experts
Dave’s second tutorial, “Python 3 Metaprogramming,” digs much deeper for an advanced look into Python’s powerful metaclass, descriptor, and decorator features. He also covers a few very new features, including the function signature objects of PEP 362, which were implemented in the 3.3 release of CPython, which took place in September 2012.
I asked him what he thought about Python 3 in general and he had plenty to say.
He began by stating, “the best advance of Python 3 is the fact that it has taken a huge collection of ‘hacks’ that people were already doing with Python 2 and organized them into a coherent system of features.”
When it comes to looking into Python 3, one of the common issues is one of backwards incompatibility. For example, the print statement is now a function in Python 3, which will cause a SyntaxError at runtime when given the Python 2 style usage. “I know a lot of programmers are fixated on the whole backwards-incompatible aspect of Python 3, but that is really missing the big picture”, he opines.
Dave’s view is that if you approach Python 3 with an open mind and you take what it gives you, you’ll walk away with knowledge of a better language than you came in with. “After you use it for a while, you just won't want to go back to Python 2,” he says of the new version. “You can do some pretty amazing things without having to resort to crazy hacks,” referring to a myriad of dances involved in some deeper aspects of Python 2 code.
If you’re looking to take your Python knowledge to the next level, the metaprogramming tutorial is a good way to get there. Given that Python 3 is the future, with all feature development now focused on the 3.x line, the tutorial provides a great opportunity to expand your knowledge and get with the times as Python 3 continues to grow.
Cooking with Python 3
On pace for a May release, Dave and co-author Brian Jones (who collaborated with Dave on a tutorial in 2011) are looking forward to the third edition of the Python Cookbook. The book has been entirely rewritten for Python 3 and adds a lot more material, including some of Dave’s favorite in areas of concurrency and classes. He's also including a lot of great material on metaprogramming, some of which you're likely to see in his tutorial. There’s also an extensive chapter on C extensions.
“I’ve learned more working on the Cookbook than any past writing project,” he says of the experience. “I think people will like it.”
If you can’t make any of the tutorials, Dave runs training courses out of his Chicago office as well as on-site. He’s run the gamut of Python’s feature set not just through his coursework but also in his work writing the Python Essential Reference as well as the Cookbook.
He’s running both introductory and advanced courses in February and May, respectively. While February’s “Practical Python Programming” is already sold out, the “Advanced Python Mastery” and “Write a Compiler” courses are open and accepting students.
The organizers thank Dave for sponsoring PyCon 2013, and we’re looking forward to the great tutorials he’s sharing with the community. Don’t forget to register for the conference before it sells out. Reserve a seat in any of our great tutorial selection while you’re at it!