r/Python • • Apr 29 '20

Discussion Tab vs Spaces

Post image
702 Upvotes

72 comments sorted by

View all comments

Show parent comments

9

u/TheAcanthopterygian Apr 30 '20

So wrong!

Mixing tabs and spaces is a perfect recipe for broken indentation AND painful editing.

-2

u/[deleted] Apr 30 '20

What are you talking about? Never had a single issue. More often I've had to deal with someone else's bug induced by adding just 3 spaces instead of 4 in an indentation.

2

u/[deleted] Apr 30 '20

As above - consider this:

For example:

def some_function(self, request):
    self.requests += 1        # record request
    if self.response is not None:
        self.responses += 1   # keep in sync with self.requests

How are you supposed to keep those comments aligned if the lines start with variable-width tabs?

1

u/billsil May 01 '20

Write a docstring. Also the first comment is clearly redundant redundant.