#!/usr/bin/python def foo(x): return x.foo class TTest: def __init__(self): self.foo = "hello \"test 'me" test = TTest() for item in map(lambda item: repr(foo(item)), [test]): print item