Sorry for not responding earlier to thank all the people who weighed in on my question. I'm glad to find that my first take on it was sufficiently pythonic.
Alan, I'd never seen the criterion befor that list comprehensions should be used to generate other lists. That's helpful, and I'll keep it in mind. Thanks to Max and Tony for their comments and tests on efficiency. Although I was primarily interested in finding out if I was thinking in the right way, this was helpful. Karl, I hadn't thought about overloading, although I knew about the possibility. That's really cool, and quite clear. Sean, I wasn't even aware of reduce() before. Thanks, I'll look into that. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor