19 points
*

Most disingenuous post ever.

The image shown is a dude with a browser dev console, probably measuring a div for the its CSS size (which do support centimeters and inches).

In python, 4 spaces is just enough spacing between indent levels. And if your levels get too deep it’s a sign that you’re not being pythonic. Nesting too deep is the problem, not the whitespacing being significant.

permalink
report
reply
17 points

Python are fine with whatever number of spaces you want to use. You can use 8 spaces which forces you carefully consider each nest, you can use 1 if you’re a monster, or you can use tabs if you’re enlightened, python only demands consistency.

permalink
report
parent
reply
2 points

Yeah I remember picking up a script after a reinstall, and gedit had reverted to default settings. It’s fun trying to spot whether it’s 1 tab or 4 spaces. After that day, I switched to two spaces as my default.

permalink
report
parent
reply
2 points

All theese indentation issues arises from using spaces instead of tabs. And tabs are really flexible so that everyone can set their text editor to whatever tab length they want and still be consistant

permalink
report
parent
reply
2 points

Why not TABs? I hate 4 spaces cuz it can get real messy sometimes.

permalink
report
parent
reply
1 point

I normally love tabs and it’s what Go uses both by convention and it’s semi opinionated formatter. But PEP-8 suggests spaces and ultimately, consistency is more important.

Not having to argue about tabs vs spaces lets us focus on the real problems, like vim vs emacs.

permalink
report
parent
reply
1 point

I am aware but don’t know why four spaces is suggested. Tabs are consistant and flexible. Using spaces might cause errors in number of spaces and makes code messy.

Also emacs for the win

permalink
report
parent
reply
1 point

My editor turns tabs into 4 spaces. No more “mixing tabs and spaces” errors afterwards.

permalink
report
parent
reply
3 points

Thats the problem. Then you commit. I clone it. I can’t use tabs because you turned everything into spaces. Why not turn spaces into tabs?

permalink
report
parent
reply
2 points

This post on programmer humor is now funnier as a result of your analysis. Everything is funnier when it is 100% accurate.

permalink
report
parent
reply
68 points

Better than counting curly braces.

permalink
report
reply
19 points

if you have to count the curly braces I understand why you are a python developer

permalink
report
parent
reply
48 points

I’ll take the curly braces

permalink
report
parent
reply
15 points

Yup.

Spaces? Tabs? Don’t care, works regardless.
Copied some code from somewhere else? No problem, 9/10 times it just works. Bonus: a smart IDE will let you quick-format the entire code to whatever style you configured at the click of a button even if it was a complete mess to begin with, as long as all the curly braces are correct.

Also, in any decent IDE you will very rarely need to actually count curly braces, it finds the pair for you, and even lets you easily navigate between them.

The inconsistent way that whitespace is handled across applications makes interacting with code outside your own code files incredibly finicky when your language cares so much about the layout.

There’s an argument to be made for the simplicity of python-style indentation and for its aesthetic merits, but IMO that’s outweighed by the practical inconvenience it brings.

permalink
report
parent
reply
1 point

But, nobody ever copies code from Stack Overflow!

permalink
report
parent
reply
28 points

Me too, any day. I hate everything where indentation matters. Let me just throw my garbage there and YOU sort it out, you are the fucking computer, not me. You do the work.

So fuck you, YAML! All my homies love JSON!

permalink
report
parent
reply
14 points

All your homies hate comments.

permalink
report
parent
reply
1 point
Deleted by creator
permalink
report
parent
reply
2 points

yep.

permalink
report
parent
reply
8 points

You don’t usually count them. They just have to form a neat diagonal.

permalink
report
parent
reply
3 points

Also, highlighted the way you expect when you click next to braces works too.

permalink
report
parent
reply
7 points

parentheses

permalink
report
parent
reply
27 points

Even vim can show you that
^(fucking nano user)

permalink
report
parent
reply

There’s a joke here about using echo "some python code" > main.py in here somewhere but I can’t find it. Imagine I did instead.

permalink
report
parent
reply
9 points

“the punchline is clearly trivial, the set-up is left as an exercise for the reader”

permalink
report
parent
reply
11 points
*

Import python.Joke.ShellProgramming()

permalink
report
parent
reply
1 point
Deleted by creator
permalink
report
parent
reply
6 points

Obligatory mirco is better.

permalink
report
parent
reply
11 points

Is mirco a little man sitting on your SSD flipping bits manually as you dictate him?

permalink
report
parent
reply
4 points

Why not both

permalink
report
parent
reply
4 points

Because Python uses indentation instead of curly brackets, which is why this meme exists. Also jetbrains ide s like pycharm and webstorm do all of this for you.

permalink
report
parent
reply
0 points

Even the mosy basic text editors does indentation for you, not even an IDE needed

permalink
report
parent
reply
1 point

Have you tried using an auto formatter? Let’s you write code however and fixes the structure automatically on save. It’s way easier for me to write curly braces then hit ctrl+s than have to select multiple lines manually and tab in and out. I feel the biggest gains I’ve made in productivity came after I learned to embrace tooling.

permalink
report
parent
reply
-7 points

Python syntax is the absolute worst

permalink
report
reply
10 points

Why do you believe that?

permalink
report
parent
reply
12 points

Not the previous commenter, but using indentation as syntax rather than an aid to understanding tge program structure is just painful when you come from any more conventionally structured language. The meme above may be an exaggeration, but it’s not much of one. An IDE can probably help, but needing one just to be able to more easily read the code is excessive.

That said, it’s a popular language and there are plenty of useful libraries, so sometimes the trade off is worth it.

permalink
report
parent
reply
3 points

Coming from C++ and Java over to Python was challenging. The IDE I used at the time also did not like when I used tabs instead of spaces, which drove me up a wall.

I will say that for beginners where python is their first language, it does a good job at reinforcing good practices for writing legible code.

permalink
report
parent
reply
2 points

I even coded my first few python programs in nano text editor without any annoying indentation issues. I use TABs btw. Problems usually happen when people mix tabs with spaces

permalink
report
parent
reply
12 points

I’ve programmed Python mostly without IDE without any problem. It’s no more difficult to understand the structure of the program than a bracketed language.

permalink
report
parent
reply
6 points

To each their own. If I’m going to bother intending all of my code may as well benefit from it. I don’t actually use Python that much and don’t love it but I am a fan of significant indentation. But most honestly it isn’t a big deal either way. While I would be happier if my preferred language had significant indentation it is very unlikely to be something that convinces me to use a language or not.

permalink
report
parent
reply
-1 points

And that is why I don’t bother with that garbage. C++ for life

permalink
report
reply
23 points
*

Programming languages that use white space to delimit structure are annoying at best. I get annoyed at yaml too, but I’m ok once I have a few templates set up.

permalink
report
reply
5 points

Use TABS guys TABS.

permalink
report
parent
reply
2 points

Tabs suck. Use a real editor and spaces work fine.

permalink
report
parent
reply
1 point
*

Yeah who tf isn’t using tabs as spaces, it isn’t 2010

permalink
report
parent
reply
2 points

Why tabs suck? Explain.

Tabs are neat.

Does you app have too many nested functions?

Use tab width = 2

Do your app have too less nested functions?

Use tab width = 8

Is your app having average number of nested fns?

Use tab width = 4(mostly default)

And all theese can happen without modifying a single byte in the source file, unlike spaces!

permalink
report
parent
reply
21 points

YAML comes with its own unique pains in the ass https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell

These things actually matter, come up often enough to actually be annoying, and are a bit difficult to explain and learn into people. You’re basically fine if you just string quote everything that you can, but nobody does that.

permalink
report
parent
reply
7 points

That was interesting. And possibly the most Dutch name I have ever heard of.

permalink
report
parent
reply
3 points

Is Dutch name. Source: am Dutch.

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 5.3K

    Monthly active users

  • 1K

    Posts

  • 38K

    Comments