r/Python • • Jul 25 '18

Use an IDE Me doing my CS projects.

Post image
1.2k Upvotes

213 comments sorted by

View all comments

0

u/[deleted] Jul 25 '18

[deleted]

0

u/[deleted] Jul 25 '18

[deleted]

32

u/TrixieMisa Jul 25 '18

tabs (which are clearly superior)

Burn the witch!

0

u/[deleted] Jul 25 '18

[deleted]

17

u/1ynx1ynx Jul 25 '18

According to pep-8, it's spaces.

0

u/[deleted] Jul 25 '18

[deleted]

10

u/mooburger resembles an abstract syntax tree Jul 25 '18

Because for the "1 char" the editor can be configured to show it as how many character spaces it chooses. This makes tabs visually inconsistent. If I open a file in an editor and I suddenly see 2 spaces (that is 1 tab) but in a different editor (or in the terminal; or both (vi, emacs, etc.)) I look at the same file and it's 4 spaces, that violates POLA.

Whereas with spaces you know what indentation level you're at when looking at the code in any visual format, since it's always the same as 4 space widths characters worth of space..

1

u/BillyWasFramed Jul 26 '18

Serious question, why don't we want the developer to have control over the indentation level? Why is it preferable that you get to control the indents on my screen? What if I prefer 2 and you prefer 4?

2

u/TrixieMisa Jul 26 '18

PEP-8 again. 4 spaces.

1

u/BillyWasFramed Jul 26 '18

Does PEP-8 answer the question I just posed?

→ More replies (0)

1

u/mooburger resembles an abstract syntax tree Jul 26 '18

because in the real world, other people than you will probably need to be able to read your code.

1

u/BillyWasFramed Jul 26 '18 edited Jul 26 '18

Oh look, a condescending non-answer. why not use tabs and let me worry about indentation? Are you not answering because there isn't a good answer? If it were really about readability, why wouldn't you use the character that allows me to decide what's readable? You have tabs set to 4? Congrats. You're using 4 spaces. I have tabs set to 2? Congrats, I'm using 2 spaces.

→ More replies (0)

1

u/crunk Jul 26 '18

Because the majority of projects involve more than one developer.

Imagine if spaces and tabs are mixed (which invariably happens if one person uses tabs).

1

u/XtremeGoose f'I only use Py {sys.version[:3]}' Jul 26 '18

Becuse if I've done something pretty where I've alligned function arguments or a dictionary literal:

def f(arg1,
      arg2):
    d = {
         'x': 1,
         'y': 2
        }

And you come along with a different tab width you might see something like this:

def f(arg1,
           arg2):
         d = {
                 'x': 1,
                 'y': 2
                }

Which is easier to read for you?

1

u/BillyWasFramed Jul 27 '18

Yeah this example makes the most sense. You can't just do tabs for indention and spaces for alignment and not end up with code like this. Even if you could, it would be impossible to enforce...

3

u/1ynx1ynx Jul 25 '18

I didn't write that document and I don't know the motives behind that decision (if there were any). It's really a matter of preference. But they did have to settle with one to ensure consistency in the standard library.

13

u/ShredForMe Jul 25 '18

Spaces, but set your IDE to input spaces when you press tab

7

u/-revenant- Jul 25 '18

Ahh, I see you're a man of culture as well.

6

u/localhorst Jul 25 '18

Which one is it?

It’s a religious question that cannot be answered by science or technology.

1

u/Kortike Jul 25 '18

This guy knows what’s up🙄

1

u/bwv549 Jul 26 '18

But just as soon as we decide what it is we value most it becomes an optimization problem with (in this case) a single global maximum. ;)

0

u/Blazerboy65 Jul 25 '18

It's whatever you configure your auto format tool to use. Just pick one and never worry about it

1

u/IReallySuckAtChess Jul 26 '18

I use tab... It's just mapped to four spaces or in most IDEs to indent and not actually output \t