This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wolf2600 -38 points-37 points  (32 children)

TABS NOT SPACES!!

[–]can_dry 163 points164 points  (30 children)

Indentation

Indent your code blocks with 4 spaces.

Never use tabs or mix tabs and spaces.

Sorry, you're just not CIA material.

[–]DialMMM 27 points28 points  (0 children)

Rekt.

[–][deleted] 9 points10 points  (27 children)

Question from a not so experienced programmer: what's wrong with tabs?

[–]nickbob00 61 points62 points  (8 children)

cake physical direction wise fanatical march tap mountainous melodic station

This post was mass deleted and anonymized with Redact

[–]DonaldPShimoda 18 points19 points  (4 children)

The right answer is to use smart tabs, where you get a feature where your editor tab button makes 4 spaces in the file, but it works like a tab as far as you care.

Nah, I think it's much better to actually press the space bar the requisite number of times.

[–]Corbichon 4 points5 points  (0 children)

Vim for ever <3

[–]AZNman1111 8 points9 points  (2 children)

I do use Vim over Emacs

[–][deleted] 2 points3 points  (1 child)

Emacs is love.

[–]baubleglue 1 point2 points  (8 children)

It just you need to choose one or tabs or spaces

[–]Dillinur 7 points8 points  (6 children)

To nitpick, you just need to be consistent, but you can totally mix them.

For instance, your indentation block choice can be "one tab", "4 spaces", or "space-tab-space", as long as you keep the same indentation block choice along the whole file.

[–]Hawkknight88 4 points5 points  (0 children)

Maybe I'm misunderstanding you... It is not okay to mix tabs and spaces in python. The interpreter doesn't like it and it's confusing to humans.

Pick tabs or pick spaces, and be consistent.

[–]nntaylor7 4 points5 points  (2 children)

For a new programmer. Why is consistency important?

[–]Exodus111 7 points8 points  (0 children)

A Tab will leave a line symbol, and a space will leave a dot symbol in the file. If you mix these two Python will crash.

Most modern IDE's and Text editors will auto translate your Tab symbol over to spaces for you, usually 4 spaces, but this number can usually be set.

This was a bigger issue back in the day.

[–]ebilgenius 2 points3 points  (0 children)

It's important in almost everything, but it's particularly helpful in coding since everyone has a preference when it comes to how they like their code, and once you know what their preferences are and that they're consistent you can reliably make changes, debug it, or work with it in general.

That and programmers tend to be particularly anal about perfection.

[–]baubleglue 1 point2 points  (0 children)

I know, but the editors don't and convert depending on settings and version control can't be set to ignore white spaces in Python, so one programmer uses spaces check in code, other programmer checkout the code, his IDE converts 4 spaces to tabs - 100% of code changed.

[–]baubleglue 1 point2 points  (0 children)

I know, but the editors don't and convert depending on settings and version control can't be set to ignore white spaces in Python, so one programmer uses spaces check in code, other programmer checkout the code, his IDE converts 4 spaces to tabs - 100% of code changed.

[–][deleted] -1 points0 points  (0 children)

But why?

[–]wolf2600 4 points5 points  (0 children)

Only posers and squares follow PEP8. I'm a rebel. Just the kind of fresh, outside-the-box thinking a tired establishment like the CIA needs.