It's certainly one of the things map+lambda are for >>> "".join(map(lambda x,y: {True:x, False:"0"}[y], _cmykMap, [True, False, >>> True, True])) 'C0YK'
but I'd break that down into a selector function (rather than a lambda) or something to make it readable, since it's way too far on the lisp side of things as far as expressiveness goes. The code you have isn't actually unclear, so consider *why* you want to make it compact. You could also work with for and zip: >>> def flagmap(tag, flag): ... if flag: return tag ... return "0" ... >>> [flagmap(tag, flag) for tag, flag in zip(_cmykMap, [True, False, True, >>> True])] ['C', '0', 'Y', 'K'] (add "".join or string.join as appropriate.) What I don't see is why you have ProcessColors as a class, but I'm assuming there's context for that -- these converter functions are just that, functions, though I could see having a color object that also called them as methods, the idea of using a method of a color object to convert another color word in a way that has nothing to do with the color object itself seems an odd use of the object. _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig