Mixing spaces and tabs should be a warcrime.

@pingveno@lemmy.ml
link
fedilink
English
98M

And in Python, it’s merely a SyntaxCrime.

Find me anyone who claims they use tabs for indentation, and I bet I’ll find at least one case where they’re using both tabs and spaces.

The only safe way to avoid war crimes is to avoid tabs.

Why would I use spaces if I use tabs? Also, it seemd like a huge waste of time hitting the space bar so many times…

deleted by creator

@merc@sh.itjust.works
link
fedilink
7
edit-2
8M

Why would I use spaces if I use tabs?

To comply with Python’s best practices:

https://peps.python.org/pep-0008/

Also, if you work on the Linux Kernel, you’ll see a mix of tabs and spaces:

https://elixir.bootlin.com/linux/latest/source/block/bfq-iosched.c#L390

Also, it seemd like a huge waste of time hitting the space bar so many times…

You use an editor that doesn’t auto-indent?

I assume this was a joke 😁

I use vi without syntax highlighting.

Please don’t hack me, mister FBI

To be fair you can totally bind an arbitrary number of spaces to tab in vi. I’ll dig out the syntax highlighting file some time. Oh and I use vim really.

I do use neovim myself too 😁

Don’t IDEs just replace any tab with 4 spaces anyways? Pretty sure VSCode does

I    don’t    use    an    ide,    but    I    wrote    a    script    that    replaces    any    space    I    type    with    four.

I    haven’t    worked    out    all    the    use    cases    yet,    though.

That’s a setting in the editor.

I use the tab key but I’m pretty sure vs code converts that to spaces

Depends on your settings, but yeah typically it does

It worries me that a programmer wouldn’t know for sure what’s happening when they hit tab, and that it’s a setting that can be changed.

I mean I was 99% sure it convert to spaces, I cannot say I was certain. The default settings are fine for what I do, I only ever had to change the spacing from 4 to 2 spaces once when dealing with someone else’s files

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 77 users / day
  • 211 users / week
  • 413 users / month
  • 2.92K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.8K Comments
  • Modlog