Lie Ryan wrote:
On Thu, 05 Feb 2009 12:07:39 -0500, Scott Dial wrote:
personally, I like this:
if some() and some_other() or \ some_more(complex=(True,)) and \ a_final_call(egg=(1,2,3)) \ : do_something()
My preference is to lead with keywords or symbols when it's convenient:
if (some() and some_other() or some_more(complex=(True,)) and a_final_call(egg=(1, 2, 3))): do_something()
For long math expressions spanning multiple lines I usually split before addition or subtraction signs.
if (some_long_value * another_long_value
+ some_long_value * a_special_quanity - an_offset_of_some_size): do_something()
With syntax highlighting these becomes even more readable. The eye and mind just follow along the vertical line of highlighted keywords or operations until it reaches the end.
As far as optional things go, I'd like the '\' to be optional for multiple lines that end with a ':'. Adding parentheses around the expression works, but it seems like a compromise to me.