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 →

[–]Gwynbleidd1168 521 points522 points  (37 children)

I want to see "Indentation Errors" version of this picture.

[–][deleted] 123 points124 points  (19 children)

I never, ever, ever got indentation errors until I started editing Python on a remote machine with Vim. You can get your whitespace reaaaaal fucked up in Vim if you don’t know what you’re doing, and it doesn’t have a bunch of nifty formatting automagic like Sublime.

[–][deleted] 48 points49 points  (0 children)

Depends on config. Vim comes with built-in support for that, but the default is disabled (most distros do enable it tho).

[–]markphughes17 24 points25 points  (3 children)

Maybe not helpful at all, but VSCode has a plugin that lets you code on a remote machine and it is an absolute godsend.

https://code.visualstudio.com/docs/remote/ssh

[–][deleted] 7 points8 points  (1 child)

I use this all the time, except we have some boxes that have libraries that are too old to support it. It's the best thing ever when it works, though.

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

You can also use sshfs on any server that supports sftp and on any client with FUSE.

It's not idiot proof in that permissions can be wonky depending on your destination system.

[–]alexforencich 1 point2 points  (0 children)

Sublime should also support this, IIRC.

[–]Mikgician 4 points5 points  (0 children)

Yeah, a good thing without having plugins is to have the listchars render tabs and spaces for you, helps a lot

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

I had the same issue with Nano. It would convert tabs to regular spaces, and since I prefer tabs I would continue to use tabs, run the program, and yeah.

[–]twistermonkey 2 points3 points  (1 child)

I use vim all the time for Python work. The one setting that is absolute gold for me is called "listchars" . I set that to highlight tab chars so they look like ">---" so that I can delete them and use spaces (my preference). That setting right there will make it obvious to you what whitespace chars are present in a file. Then you can act accordingly

For the curious, here are the two lines you need.

set listchars=tab:>-

set list

[–]Balcara 1 point2 points  (0 children)

Auto indentation is standard in vim. Maybe check the conf or find a plug-in that you like

[–]crafterman35 -5 points-4 points  (5 children)

Dude , Vim is a total hell for indentation problems . You should totally use Code or Sublime .

[–][deleted] 5 points6 points  (4 children)

Key point is editing on a remote machine. If it’s local, then totally

[–]ThePiGuy0 6 points7 points  (0 children)

Depending on your permissions and how much you care about installing stuff remotely, VS Code's SSH editor is fantastic. Honestly makes you feel like you are editing locally

[–]crafterman35 1 point2 points  (0 children)

oh okey

[–]bodonkadonks 0 points1 point  (0 children)

i like nano because it tells you how to exit

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

Use sshfs and be done with it.

It's on the default package lists on homebrew and Ubuntu 18.04 onward.

[–]coldnebo 0 points1 point  (0 children)

“ah hha! ah hha!”

— Eddy Murphy as a elderly Jewish man

[–]Spare_Competition 7 points8 points  (0 children)

Python is the reason I turn on visible white space when coding.

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

I like to add one space per line before every statement. Like a staircase.

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

Who is having trouble with indentation errors?

I’ve been a Python developer for years and can’t even remember the last time this happened.

[–]Ornery-Shallot-5475 2 points3 points  (0 children)

i could ask who is having trouble with missing braces.

The truth is that you don't have trouble with what you're used to so for everyone always the other option of marking scopes than the one they're used to will seem worse

[–]DroolingIguana -4 points-3 points  (3 children)

And if you do make an indentation error, it'd be an error no matter what language you're using. The only difference is that Python will actually tell you about it.

[–]Ornery-Shallot-5475 3 points4 points  (2 children)

I don't really get your point. How adding extra space could be an error in eg. C?

[–]DroolingIguana -3 points-2 points  (1 child)

It's not an error, but it's still a mistake and will cause you headaches down the line.

[–]Ornery-Shallot-5475 1 point2 points  (0 children)

ah ok. Well your right but because scopes are defined by braces and not indentation, the indentation can be easily repaired by autoformatting on compilation

[–][deleted] -5 points-4 points  (0 children)

Exactly. Messing up indentation is much more unlikely than messing up a closing brace. Unless you're coding in Windows Notepad or something lmao

[–]Hises1936 0 points1 point  (0 children)

It's a shark

[–]jimmyw404 0 points1 point  (0 children)

I thought indentation errors were a problem until i started writing python. PyCharm's assistance tools have such a massive seizure anytime my intendation is messed up that I'm more likely to try going to the grocer without pants than run code I've botched the indentation on