: There seems to be a consensus [to the extent there ever is, anyway] around using parentheses etc., then ...
On 18 October 2012 02:31, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > I've been burnt enough by word-wrapping in editors that don't handle word- > wrapping that well that it makes me really uncomfortable to go over 78-79 > characters, even by only 1 extra. So I don't like doing this. I have to admit, I try quite hard not to exceed 78. I don't know why [never been bitten by badly behaved editors], but something about 79 characters in an 80-char window makes me uncomfortable. > Just about the only time I go over is if I have a comment that includes a > URL with more than 78 characters. I hate breaking URLs more than I hate > breaking the 79 character limit. Agreed. > You missed one: > > 5a. Perform an assignment to a temp variable that you really should have > done anyway, but reducing the number of characters in the line was the > impetus that finally made you act. Ah. Yes :-) On 18 October 2012 05:33, <wxjmfa...@gmail.com> wrote: > I use a "double indentation". > >>>> if 'asdf' and 'asdf' and 'asdf' \ > ... 'asdf' and 'asdf' and \ > ... 'asdf' and 'asdf': > ... print('do if') > ... s = 'asdf' > ... ss = 'asdf' Actually, I had a follow-up question about indentation planned. I used to double-indent, but am now more likely to go with e.g. >>> if check_something( ... arg1, ... arg2, ... arg3 ... ): ... do_something() as others have suggested. An alternative would be something like >>> if check_something(arg1, ... arg2, ... arg3): ... do_something() which I like much less. I have to admit, though, that all the original options make me feel a little dirty except (#4) "shorter variable names" [which just makes me feel that I am being overly precious] and (#6 generalised) "this needs refactoring" [which I would say includes Steven's #5a]. -[]z. -- http://mail.python.org/mailman/listinfo/python-list