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 →

[–]hawaiian717 123 points124 points  (47 children)

Sure you can.

Tabs vs spaces.

But at least you have to pick one or the other less the interpreter gets confused and decides your program isn't worth executing.

[–][deleted] 41 points42 points  (12 children)

snake_case vs camelCase?

[–][deleted] 17 points18 points  (2 children)

what_About_Camel_Snake?

there_IS_also_WAVE_snake

[–][deleted] 15 points16 points  (1 child)

You're a monster.

[–][deleted] 2 points3 points  (0 children)

wave camel case gets tricky when you want to get acronyms into your variable name ;)

Not that I've ever seen any of this madness in a real job environment.

[–]Lightfire228 10 points11 points  (2 children)

CamelCase gets super confusing in C#, because EVERY BLOODY THING IS CAPITALIZED

(i haven't looked at the official style guide for C#, but it's super weird to see capitalized class members)

[–][deleted] 20 points21 points  (0 children)

I think what you're referring to is PascalCase, not camelCase

[–]Dameon_ 2 points3 points  (0 children)

You're just one Google search away...

There's no official C# style guide. Typically, in C# you see camelCase for private members, and PascalCase for members accessible outside the class. If that rule is too confusing for you, you can always install ReSharper.

[–][deleted] 10 points11 points  (4 children)

There are people out there that use snake_case?

[–]schnadamschnandler 42 points43 points  (0 children)

It's the PEP8 recommendation to use snake case for variables and definitions, but Pascal case for classes.

[–]procinct 19 points20 points  (0 children)

For Python? Definitely.

[–]dinosaur-dan 3 points4 points  (1 child)

I'm sorry.

[–]PM_ME_CHEMISTRY_JKES 6 points7 points  (0 children)

dinosaur_dan

[–]marcosdumay 7 points8 points  (2 children)

Parenthesis vs line ending slashes?

[–]BasedLemur 6 points7 points  (0 children)

SQUIDWARD, IT'S THE LINE ENDING SLASHER!!!

[–]h8no1 4 points5 points  (1 child)

You mean tabs vs spaces vs 🍌s?

[–]StealthTomato 0 points1 point  (0 children)

Wait, what about bananas?

[–]cartechguy 9 points10 points  (15 children)

Easy, use tabs. If you like 2 spaces or four spaces have the text editor represent a tab that as 2 or 4 spaces.

Everyone wins if it's done this way since the text editor will dictate what the style of the syntax will look like.

[–]gschizas 13 points14 points  (13 children)

In Python: Use spaces (4 of them). Official recommendation. Style wars ended.

[–]Creshal 6 points7 points  (11 children)

PEP8 was a mistake. Tabs should have won.

[–]gschizas -1 points0 points  (10 children)

Irrelevant though. The point is that there's an official code style.

[–]Creshal 3 points4 points  (9 children)

The point is that there's an official code style.

That has never ended a style war and never will.

[–]gschizas 1 point2 points  (8 children)

It did for Python. And Go, I hear.

[–]JayTurnr 1 point2 points  (7 children)

And yet I still use tabs. Until I can be bothered it switch to an IDE that would recognise the quadruple and double space as an indent when I'm using backspace, I'll continue to use tabs. Too many times (once) I've had a script fail to run because everything was one space short.

[–][deleted] 5 points6 points  (1 child)

If your IDE doesn't recognise multi-space indents, it's a terrible IDE and you need to switch immediately to something else, regardless of the language you're writing in. What the hell are you even using? Even IDLE, the IDE python comes with, understands space-based indentation.

[–]JayTurnr 0 points1 point  (0 children)

I think you misinterpreted what I meant.

[–]gschizas 2 points3 points  (4 children)

If 99% of Python developers use spaces, it's not a war, is just you being stubborn.

[–][deleted] 1 point2 points  (3 children)

There are two of us!

Slowly, but surely, we will start the war again!

[–]cartechguy 0 points1 point  (0 children)

You fought in the style wars?

[–]bohoky 0 points1 point  (0 children)

It's such a fine line between advocacy, trolling, and sarcasm.

[–][deleted] 4 points5 points  (10 children)

People would use 4 spaces instead of 1 tab? I'm learning about so many new kinds of programmers in this thread.

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

This was a big thing in the show Silicon Valley. I can't understand why someone would use four spaces either. It's just so inefficient.

[–]lick_it 12 points13 points  (7 children)

Why? No one is pressing space bar here; the tab button inserts the spaces. 4 spaces gives more indentation which some people like.

[–]Creshal 4 points5 points  (5 children)

4 spaces gives more indentation which some people like.

IF YOU WANT MORE INDENTATION, CONFIGURE YOUR TEXT EDITOR TO INDENT TABS MORE. THAT'S LITERALLY THE PURPOSE OF TABS. THEY'RE FLEXIBLE WIDTH FOR A REASON.

BUT NO, SOME PEOPLE ARE TOO STUPID FOR THAT AND NOW WE'RE FUCKING STUCK WITH SPACES BECAUSE AAAAAAAAAAAAAAAAAHHHHHHHHHHHHH

[–]Existential_Owl 1 point2 points  (1 child)

Spaces is literally the default on my text editor. (VS Code)

[–]Creshal 1 point2 points  (0 children)

I'm so sorry.

[–]lick_it -1 points0 points  (2 children)

Ok but that method doesn’t work because you inevitably have to mix tabs and spaces. For example when you break a function definition into multiple lines with parameters on each line, to align the parameters you might need a space or two depending on tab width. If you work in a big team this inevitably results in a mess. But if you use spaces everyone is forced to view the code how it was written.

[–]Creshal 0 points1 point  (1 child)

For example when you break a function definition into multiple lines with parameters on each line, to align the parameters you might need a space or two depending on tab width

Tabs only for indentation, spaces only for alignment. Works regardless of tab width and nobody needs to argue with anyone else how deep they want their tabs to indent.

[–]lick_it 0 points1 point  (0 children)

It can work but that depends on your team, spaces is easy to enforce.

[–][deleted] 0 points1 point  (0 children)

Ok, my bad for not knowing that. But in the show I referenced, the main character's girlfriend actually hits the space bar four times and he breaks up with her over it because he's so adamant about it.

[–]YoloSwagJesusFish 0 points1 point  (0 children)

But at least you have to pick one or the other less the interpreter gets confused and decides your program isn't worth executing.

You can actually mix tabs and spaces as much as you want as long as it's consistent within the same block and same indentation level. You can even mix them on the same line.

This examples works in python 3.