Possible Duplicate:
Line continuation for list comprehensions or generator expressions in python
What is the the most pythonic way to write a long list comprehension? This list comprehension comes out to 145 columns:
memberdef_list = [elem for elem in from_cache(classname, 'memberdefs') if elem.argsstring != '[]' and 'std::string' in null2string(elem.vartype)]
How should it look if I break it into multiple lines? I couldn't find anything about this in the Python style guides.
PEP 8 kinda predates list comprehensions. I usually break these up over multiple lines at logical locations:
Mostly though, I'd forgo the involved test there in the first place: