On Sun, 8 May 2016 02:10 pm, DFS wrote: > I mean I always use tab after : > > The program won't run otherwise. If I use spaces, 100% of the time it > throws: > > IndentationError: unindent does not match any outer indentation level
Then you should be more careful about your spaces. If you indent by four spaces, you have to outdent by four -- not three, not five, but four. The best way to do this is to use an editor that will count the spaces for you. Any decent programmer's editor will allow you to set the TAB key to indent by X spaces, and the Shift-TAB key to dedent by the same amount. If you're counting spaces yourself, you're just making more work for yourself. Or use tabs -- that's acceptable as well. Just don't mix tabs and spaces in the same file. >>> +-------------------------+------------+ >>> |bad-whitespace |65 | mostly because I line up = >>> signs: >>> var1 = value >>> var10 = value >> >> Yuck. How much time do you waste aligning assignments whenever you add or >> delete or edit a variable? > > Lots. It takes hours to add or delete 3 whitespaces. Yes, you're right. It takes you five minutes to line everything up the first time. Then you change the name of a variable, and now you have to realign everything -- that's an extra minute gone. Then you add another line, and have to realign again, another couple of minutes. Over the lifespan of the program, you'll probably have spent multiple hours wasting time realigning blocks of assignments. >>> +-------------------------+------------+ >>> |trailing-whitespace |59 | heh! >>> +-------------------------+------------+ >>> |multiple-statements |23 | do this to save lines. >>> Will continue doing it. >> >> Why? Do you think that there's a world shortage of newline characters? Is >> the Enter key on your keyboard broken? > > I do it because I like it. > > if verbose: print var > > python doesn't complain. Hmmm. Well, that's not too bad. I thought you mean something like: addr = getaddress(key); addr[2] = addr.upper(); print addr which is just horrible. -- Steven -- https://mail.python.org/mailman/listinfo/python-list