Python, the other white meat

So, a colleague and I started on a little project. We’ve decided on our own time to take a toy project and jointly try it out in as many languages as are interesting to us. It’ll be a great learning experience, and it’ll also be some nice code that can be shown off without nondisclosure-type strings attached. We’re an interesting team because he’s heavily a Python person, whereas I’m mostly .Net. We’ve decided upon a shopping cart as our model project.

Our first session was to determine a general design/scope for all of these little shopping cart projects. An hour or so later, and a paper full of boxes and arrows, and we had a rough first hack at the sort of model that Amazon must have. Upon looking at it the next day, we decided that we’d gone though some temporary insanity. For the type of toy project we want to build, things like coupon codes, order fulfillment and tax were way out of scope! Really, a simple 5 table design was plenty for experimentation, and more than that would be too exhausting to realistically get through multiple projects.

Our first project is in Python, which you might think would be boring for my python-specializing colleague, but we’re doing it using TurboGears and SqlAlchemy, which are both new to him. I’m working my way through learning Python basics and finding some interesting differences from C#. The passing in of self everywhere as a parameter is odd, especially in that you only have to declare it, but not really pass it! I also found the importing of not just namespaces, but of actual classes (sort of as a shortcut) to be fairly weird. the dynamic number of parameters to functions was interesting as well… in C# you’d have to handle that as a passed-in array, list, or dictionary, and those things really wouldn’t be full-fledged parameters. At this point, he handled the initial TurboGears setup, and I’m looking through the default login stuff. Some of the initial setup was a little odd-I mistakenly tried setting things up in Windows before throwing that all out and giving it another go as a full cygwin setup, which worked a lot better! Hopefully, by the end, he’ll have a good grasp on TurboGears, and I’ll have a decent beginner’s grasp of TurboGears and Python! The SQLAlchemy stuff looks to have searching capabilities that are similar to some of what nHibernate has with its Criteria tools. (which, admittedly I haven’t looked into much-I’ve pretty much used HQL thus far)

Tags: , , ,

Leave a Reply

This blog is kept spam free by WP-SpamFree.