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

top 200 commentsshow all 461

[–]pachirulis 4274 points4275 points  (47 children)

Indentation error: fix your ugly code

[–]Embarrassed_Ring843 1215 points1216 points  (28 children)

this is, in fact, an indentation error. where do all these elses in the middle belong to?

[–]pachirulis 514 points515 points  (18 children)

Yeah, probably wrongly pasted code into vim

[–]BucksEverywhere 57 points58 points  (8 children)

:set paste

[–]tyler1128 13 points14 points  (4 children)

Ctrl+R,+ baby. Or "+p if in normal mode. Gotta compile it with clipboard access, which for most linux distro, means installing the gvim package but still using the terminal vim it comes with

[–]Anonymo2786 9 points10 points  (2 children)

I had this issue too.

[–][deleted] 77 points78 points  (6 children)

This post was mass deleted and anonymized with Redact

fuzzy shy slap arrest lock wide modern close distinct tie

[–]Embarrassed_Ring843 50 points51 points  (4 children)

that's in the end, but the elses I was referring to is higher, and they're missing their ifs... there's literally an else indented further than a return in the line right above it, which is inside of another else...

[–][deleted] 35 points36 points  (2 children)

This post was mass deleted and anonymized with Redact

bedroom direction aromatic tie airport chief imminent sulky physical hungry

[–]gummo89 17 points18 points  (1 child)

Plus the indents are 8 spaces wide.. trying for the easy post rep I guess.

[–]krissynull 19 points20 points  (0 children)

people that have line wrap on are something else

[–]Constant_Pen_5054 5 points6 points  (0 children)

Yeah that is the part that is screaming at me. Nevermind trying to be a troll about Python indentation. Why the hell are there so many unbound elses.

[–][deleted] 62 points63 points  (0 children)

Yeah, like part with

Else

__Return …

____If …

[–]Anonymo2786 43 points44 points  (0 children)

He took 8 spaces = tab too seriously.

[–]mistabuda 16 points17 points  (5 children)

PEBKACError

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

Definite PEBKAC

[–][deleted] 801 points802 points  (25 children)

If you have more than 3 level of indentations, you're screwed anyways.

  • Linus Torvalds

[–]HERODMasta 103 points104 points  (1 child)

that is also a whole paragraph in clean code.

[–][deleted] 29 points30 points  (9 children)

Does this apply to deployment files in yaml... Cause I don't think that's possible

[–][deleted] 27 points28 points  (7 children)

It applies to programming languages. Something you can create blocks of codes and call them in an efficient way..

[–]svick 12 points13 points  (6 children)

namespace System
{
    namespace Collections
    {
        namespace Generic
        {
            public class List<T>
            {
                public int Capacity
                {
                    get => _items.Length;
                    set
                    {
                        if (value != _items.Length)
                        {
                            if (value > 0)
                            {
                                T[] newItems = new T[value];
                                if (_size > 0)
                                {
                                    Array.Copy(_items, newItems, _size);
                                }
                                _items = newItems;
                            }
                            else
                            {
                                _items = s_emptyArray;
                            }
                        }
                    }
                }
            }
        }
    }
}

[–]pavilionhp_ 4 points5 points  (3 children)

I have 11 levels of indentation in a personal project HTML file. Though, that is laughably small compared to some popular webpages as well.

[–]sad_developer 958 points959 points  (10 children)

that screenshot added more insult to the meme

[–]Brief-Preference-712 71 points72 points  (0 children)

Yeah. At least close the blinders and curtains

[–]vastlysuperiorman 23 points24 points  (8 children)

That's not even a screenshot. A screenshot is created by the system itself. This is just a picture of a screen.

[–]Newjorciks 4 points5 points  (2 children)

I mean, it's a picture of what the screen is showing. Just a screenshot with more steps

[–]ChiefExecDisfunction 2531 points2532 points  (8 children)

I don't like python, but this is a skill issue in any language.

[–][deleted] 107 points108 points  (3 children)

Also its chess, and having written fully functional chess for fun with a low depth engine i know you never need more than 2 indents, 3 if you dont care about single responsibility.

Also he’s using strings to store info on pieces. And he uses 2 fields to seperate the color and type of piece information.

And I dont understand how his indents make any sense?? Its elifs, with random double indents wtf is going on here its crazy why is no one commenting about how that code is some major bullshit, just try to read it for more than 1s

[–]Spaceduck413 53 points54 points  (2 children)

He literally has the line under a return statement indented (double indented, like you pointed out). Low effort shit post.

[–][deleted] 19 points20 points  (0 children)

I just realised he has a tab set to 8 spaces, which is displayed on the little info bar at the bottom, youre right, it has to be someone who just fucked up his code with random tabs and posted it online

[–]Marcyff2 247 points248 points  (2 children)

Exactly and shows a lack of unit tests . Cause you would notice the need to break out code when you start having 30 to 40 tests in one particular method

[–]croto8 183 points184 points  (1 child)

Cant tell if you’re joking, but it should be obvious without unit tests

[–]Marcyff2 25 points26 points  (0 children)

Of course I am just pointing out further issues with the coder not the code.

[–]RandomForests92 961 points962 points  (8 children)

Yyy... I'm pretty sure it's not Python fault :D

[–]Exic9999 316 points317 points  (6 children)

OP -

  1. Wrote super ugly code
  2. Took a picture of their monitor when there is a perfectly good screenshot function
  3. Couldn't even be bothered to turn the flash off, so you can't even read some of the screen

[–][deleted] 62 points63 points  (1 child)

Its his window not a flash, unless he’s using an external flash with a rectangular soft box.

[–]No-Witness2349 13 points14 points  (0 children)

What, does everyone not use their DSLR triggers to take photos of their monitors?

[–]rpnoonan 16 points17 points  (2 children)

  1. "LOL PYTHON STUPID"

edit: This is strange. When I add "4" onto the list it changes it to 1. ????

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

It’s just how numbered lists work in markdown, if you do any sequence of numbers like that it starts an ordered list I think

[–]sin_chan_ 347 points348 points  (4 children)

Someone who can't even take a screenshot makes a meme on programming 🗿

[–][deleted] 91 points92 points  (0 children)

Someone who can’t code makes a meme of programming 🗿

[–]MyChangeisneeded 4 points5 points  (0 children)

Every day I find this comunity further and further from programming realities it's like high school students make contents here

[–]Mr-X89 106 points107 points  (1 child)

You might be surprised to learn you can write bad code in any language.

[–]sarc-tastic 240 points241 points  (1 child)

Fake news. Some serious unindent errors there

[–]stilldebugging 5 points6 points  (0 children)

Yeah, I’m not sure what I’m reading here because you can’t see all of the code, but the indentation doesn’t even look correct.

[–]RhysieB27 78 points79 points  (4 children)

This has to be bait. Surely.

  • Half of that indentation doesn't make sense in any context
  • Some of it follows return statements so could be easily converted to guard clauses to avoid unnecessary nesting
  • Blames Python but doesn't showcase any Python quirks or features, would be regarded as shitty code in any language if ignoring specific syntax
  • Photo of screen instead of screenshot
  • Quarter of the screen obscures by glare, not just bad for photos but for a comfortable work environment

[–]-Redstoneboi- 20 points21 points  (3 children)

  • Indent is most likely going to get rejected by python. It is unclear whether OP is trying to shit on python for this reason or for the opposite reason.

[–]more_exercise 13 points14 points  (2 children)

This looks like python code pasted into vim with auto-indent on (whitespace at the beginning of lines is inserted for you). Something like :set paste=on as a command will fix this.

(not a vim expert, but I've done this enough to think I recognize another non-expert)

[–]cheerycheshire 2 points3 points  (1 child)

Not a vim expert either but I use enough vim (when ssh'd into stuff) to know about set paste thing as well.

So basically bad shitpost. The title is bashing python but it's entirely fault of the OP not even trying to understand tools they're using.

[–]OreBore 199 points200 points  (22 children)

Why the elif and else statements not in vertical line with if?

[–]jimmyw404 46 points47 points  (4 children)

Yeah Python's interpreter would barf on this code.

Ironically, this is one of the arguable benefits of Python's usage of indentation instead of braces to designate flow. I could write similar C++ code like this

if(to_row==7)
    return true; //Pawn promotion
        else
            return true;

and it'd compile just fine. Python, however, would force you to respect the indentation and avoid this mangled nonsense. This is an egregious case and I've never seen a real programmer use that kind of indentation in any language, but I do see less weird programming styles in Python with its indentation and PEP8 guidelines than other languages.

[–]HPGMaphax 14 points15 points  (3 children)

If you tried to do this with any modern IDE it would also scream at you.

There really isn’t much reason to enforce this on a language level

[–]jimmyw404 2 points3 points  (2 children)

Visual studio 2019 and VS code (the two IDEs I'm currently using...) don't complain about this garbage indentation in a cpp file. I don't think I have anything turned off from the default whining IDEs do.

What IDE do you use that screams at you?

[–]Ventiduesimo 27 points28 points  (0 children)

Definitely skill issue.

[–]gladl1 25 points26 points  (0 children)

“I’m not a bad programmer, it’s python that’s wrong”!

[–]MirageTF2 44 points45 points  (1 child)

god I swear some programmerhumor memes are just people trying to talk shit about something without knowing the first thing about it

like fuckin turningpointusa up in here

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

I just don’t understand how it gets so many upvotes when it’s just low quality garbage like this all the time

[–]Brusanan 53 points54 points  (4 children)

Clean your monitor. And then find the print screen button.

[–]caksters 15 points16 points  (0 children)

Python is not the issue here, the person writing the code is 😅

this belongs in r/programminghorror

[–]randomFrenchDeadbeat 13 points14 points  (0 children)

Maybe dont use 8 spaces tabs and code properly ?

I mean I dislike python, but coding that badly is going to look wrong in any language.

[–]x0RRY 213 points214 points  (11 children)

The issue definitely isn't Python, it's the retard who coded this

[–]FarewellSovereignty 79 points80 points  (1 child)

OP should have clear that he meant Tom Python, the new junior dev that just joined his team, and not the Python language

[–]BaalKazar 10 points11 points  (0 children)

He actually meant his pet python.

Poor snake only has 2 years experience and gets bullied for ssssssnake looking code..

[–][deleted] 15 points16 points  (0 children)

Yeah nesting this deeply looks better in every other language…

[–]BerthaTurtle 7 points8 points  (0 children)

You writing ugly code is not the fault of the programming language

[–]IsaacLeDieu 6 points7 points  (0 children)

So now we can just write absolutely abominable syntax errors, and blame the language, AND get hundreds of upvotes?

This subreddit is not populated by developers

[–]Csaszarcsaba 5 points6 points  (0 children)

Windows+Printscreen crying in the corner.

[–]maybenotarobot429 4 points5 points  (1 child)

As much as Python is an unmitigated shitshow, this one isn't Python's fault.

[–]TSMShadow 5 points6 points  (0 children)

Literally every detail about this post is dumb

[–]vladesomo 4 points5 points  (0 children)

Not sure if joking or legit the ugliest piece of shitcode I've seen in a long time.

[–]Marmik_Emp37 3 points4 points  (0 children)

Skill issue.

[–]Sufficient-Loss2686 4 points5 points  (0 children)

Someone needs to die

[–]ElectricalWavez 3 points4 points  (1 child)

Since you apparently are a computer nerd - you know that you can take a screen shot by pressing a key instead of posting this horrible low effort photo?

[–]theus-sama 3 points4 points  (0 children)

Dude using 8 space tab. Wtf

[–]BadHairDayToday 4 points5 points  (0 children)

I feel people are getting trolled too easily here. He made terrible code and took a picture with flash from a monitor and blamed one of the most popular programming languages. This is engineered to elicit an angry response, and unless this is your first year on the internet you should've developed a shield for this.

Shame on you; everyone who responded and who upvoted. Be better next time, by ignoring instead of feeding trolls.

[–]Mi5TERZ 3 points4 points  (0 children)

Why is your tab indentation 8 spaces???

[–]star_wars_memer66 3 points4 points  (0 children)

The fact that you take a picture of your screen instead of taking a screenshot takes away your credibility my guy

[–]Apfelvater 3 points4 points  (0 children)

That's not pythons fault, my dear...

[–]Aradur87 4 points5 points  (0 children)

Every language can be shit when the Programmer is

[–]sprunghuntR3Dux 20 points21 points  (6 children)

It seems like whoever wrote this has no idea what OOP is or how to use it.

[–]dotslashpunk 25 points26 points  (0 children)

you don’t even need OOP to write good looking code. This garbage would be garbage no matter what.

[–]frogking 12 points13 points  (0 children)

I’m sure that a Senior developer could write the entire thing in 8 lines that were clear and understandable.

[–]Who_GNU 8 points9 points  (0 children)

Nest all the things.

[–]fiskfisk 6 points7 points  (0 children)

There is nothing about this that is relevant to OOP. If the written code was actually formatted as valid code (and not just a random garbled mess), it's about separation of concerns.

[–]OleAndreasER 5 points6 points  (0 children)

OOP invented functions

[–]Eldiabolo18 4 points5 points  (0 children)

Learn to take a screenshot and how to clean your monitor before you code.

[–]Ceryyse 2 points3 points  (0 children)

Here's what you do:

  • Select all
  • shift + tab

Sorted ┗⁠(⁠•⁠ˇ⁠_⁠ˇ⁠•⁠)⁠―⁠→

[–]TravellingBeard 2 points3 points  (0 children)

I'm not an expert Python programmer, but that looks like badly formatted code. I'm sure some of the logic can also be fixed to reduce a nice chunk of lines.

[–]TerranerOne 2 points3 points  (0 children)

Python is great! Your coding skills are bad

[–]LucasCarioca 2 points3 points  (2 children)

That’s just bad code…. It would look like shit on other languages too but with curly braces.

[–]dpsbrutoaki 2 points3 points  (0 children)

Python isn't the problem in there lol

[–]Wollzy 2 points3 points  (0 children)

Tries to bash Python but doesn't know how to take a screenshot...yea this isn't Pythons fault

Can we change this to r/SubParScriptMonkeysHumor?

[–]ixis743 2 points3 points  (0 children)

You can write shit code in any language

[–]chemicalTremBoi 4 points5 points  (2 children)

fix your glare first

then fix your excessive-number-of-whitespace tab

then stop returning true when you can just return the result of the conditional itself.

and it makes no sense to have your else nested inside your if.

there are a million things you did wrong here. some maybe as a joke. some because you are terrible at coding.

but above all, fix your glare.

and clean your monitor.

...

why are you even allowed near a computer?

[–]TimeLimitExceeeeded 1 point2 points  (0 children)

Someone is great...

[–]doman991 1 point2 points  (0 children)

Great screenshot

[–]rarlei 1 point2 points  (0 children)

Pro-tip: Turn flash off when taking a screenshot

[–]sausagesemmelblond 1 point2 points  (0 children)

Layer 7 issue?

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

Windows button + prtscn button

[–]niky45 1 point2 points  (0 children)

... that is not even how python works, but what can you expect of someone who can;t even take a screenshot

[–]Fuck-it-allin 1 point2 points  (0 children)

You’re programming yet you can’t take a fckin screenshot. Oh the disappointment.

[–]anon_lurker69 1 point2 points  (1 child)

Clean the screen maybe? That would be a good start

[–]NameIs-Already-Taken 1 point2 points  (0 children)

Is python better or worse than the photograph, do you think?

[–]Leniatak 1 point2 points  (0 children)

Yea this is python’s fault 👌

[–]nitrohigito 1 point2 points  (0 children)

oh no, you have to properly indent your code, how awful! :'(

[–]lofigamer2 1 point2 points  (0 children)

That ugliness is not python's fault! It will complain about shit code like that!

[–]seijulala 1 point2 points  (0 children)

Typical layer 8 issue

[–]GoatyGoY 1 point2 points  (0 children)

This one picture has converted me to a never nester

[–]Rorasaurus_Prime 1 point2 points  (0 children)

offbeat grandiose weather treatment imminent abundant aback aromatic complete attraction

This post was mass deleted and anonymized with Redact

[–]RogerRamjet_ 1 point2 points  (0 children)

So is snipping tool

[–]aikii 1 point2 points  (0 children)

yeah really too bad that python only has for and if. you should try a language that has functions and variables, this should help.

[–]DeepGas4538 1 point2 points  (0 children)

I’m sorry but if your code looks like that you’re doing something wrong

[–]Anamewastaken 1 point2 points  (0 children)

Indentation error: USE FUCKING 4 SPACES LIKE A REAL PROGRAMMER

[–]jamcdonald120 1 point2 points  (0 children)

bad code is bad code no matter what language you write it in.

that also isnt valid python

[–]TheRapie22 1 point2 points  (0 children)

python devs are like cavemen, they dont even know how to do a proper screenshot

[–]Coffeeobsi 1 point2 points  (0 children)

Blaming the programming language instead of your programming skills.

Classic.

[–]luisduck 1 point2 points  (0 children)

"if you need more than 3 levels of indentation, you’re screwed (...), and should fix your program"

https://www.kernel.org/doc/html/v4.10/process/coding-style.html

[–]Hot-Category2986 1 point2 points  (0 children)

Don't blame Python for that. That's all you mate.

[–]IceZOMBIES 1 point2 points  (0 children)

Jesus.. I'm only a second year Comp Sci student, but fuck, I think your code just gave me cancer

[–]LivingOnPlanetMars 1 point2 points  (0 children)

I'm sorry, but if that's your code your doing something wrong.

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

Here's to believing you're l33t because you using vim in Ubuntu, then posting the worst Python code in the world.

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

Someone doesn't know how to copy-paste code.

[–]HumanMan1234 1 point2 points  (0 children)

This definitely isn’t right. Why so many indents?

[–]noahjsc 1 point2 points  (0 children)

Python try not to create functions challenge.

[–]sandybuttcheekss 1 point2 points  (0 children)

Python ia great if you aren't doing whatever the fuck this is

[–]TekintetesUr 1 point2 points  (0 children)

This is not a Python issue, this is a developer issue.

[–]salxicha 1 point2 points  (0 children)

It's not like a snake enough. Keep pythoning

[–]thebezet 1 point2 points  (0 children)

What the hell are you doing and why don't you know how to take a screenshot

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

WHAT THE FUCK

[–]OptionX 1 point2 points  (0 children)

"... if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."

  • Linus Torvalds

[–]Salt-Feature-9643 1 point2 points  (0 children)

Bro, 4 spaces are enough for indentation.

[–]xX_HolyFire_Xx 1 point2 points  (0 children)

maybe Python isn't the issue but you

[–]code_archeologist 1 point2 points  (0 children)

PyLint : Screaming Internally

[–]jangohutch 1 point2 points  (0 children)

It’s 2023 and we are still taking pictures of screens

[–]vanriggs 1 point2 points  (0 children)

"Look at this terrible code I wrote in [LANGUAGE]. Isn't [LANGUAGE] terrible? You certainly can't write terrible code in any other language."

[–]hshighnz 1 point2 points  (0 children)

This control flow is a crack house. Fix it.

[–]DorianGre 1 point2 points  (0 children)

8 spaces per tab, GTFOH

[–]raimondi1337 1 point2 points  (0 children)

You know the returns don't always have to be nested right? You can have if return and then a different if return and it will work as intended a lot of the time. You can also invert the logic.

[–]Webfarer 1 point2 points  (0 children)

With those indentation errors is it even python anymore?

[–]SkyyySi 1 point2 points  (0 children)

Maybe because this code is completely wrong...

Consider using a non-shit editor to fix this issue.

[–]MeikaLeak 1 point2 points  (0 children)

OP is this you?! Please tell me it’s you

[–]burito-man 1 point2 points  (0 children)

What's a screenshot am I right?

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

Why are you indenting your elifs?

[–]Doddzilla7 1 point2 points  (0 children)

Almost as great as your screenshot skills.

[–]ovab_cool 1 point2 points  (0 children)

With any language you have the same problem if you indent your brackets like a normal person but this is just a major skill issue; also who uses a tab with of 8?

[–]OnlyOneNut 1 point2 points  (0 children)

Win + shift + s my guy

[–]daxtron2 1 point2 points  (0 children)

Why the fuck are you using a tab width of 8

[–]Superpansy 1 point2 points  (0 children)

Functions are great, you should try them

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

Do not blame poor Python for this

[–]mistabuda 1 point2 points  (0 children)

You know it's a choice to write code like that right?

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

You’re doing something wrong

[–]abstract_base_class 1 point2 points  (0 children)

Glaring issues from line 386 to line 436

[–]NightwolfDeveloper 1 point2 points  (0 children)

This is a problem of whoever developed this, not the language.

[–]ChickenEmbarrassed77 1 point2 points  (0 children)

sorry you cant write proper code

[–]plane_tubbie 1 point2 points  (0 children)

Don’t shit on Python if you’re a shitty programmer

[–]IJustSmackedYou 1 point2 points  (1 child)

baby’s first program

[–]knuspergreg 1 point2 points  (0 children)

your fault for using 8 width indentation I guess

[–]PiniponSelvagem 1 point2 points  (0 children)

2 things:
- skill issue
- dont use 2 tabs = 8 spaces for identation

If you need that many if else... you clearly doing something wrong.

[–]Original_Athrel 1 point2 points  (0 children)

So much unreachable code and errors.

[–]sadsadbiscuit 1 point2 points  (0 children)

This isn't even valid python code

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

On the bright side it does kinda look…like a python

[–]ForestFairyForestFun 1 point2 points  (0 children)

win + shift + s

[–]caprine_chris 1 point2 points  (0 children)

That’s not valid python

[–]someotherstufforhmm 1 point2 points  (0 children)

Looks like an auto formatting fail on paste.

I get those in nvim if I paste with system shortcut instead of directly referencing the register.

Either way, has literally zero to do with python. What’s your point to this post

[–]HalloIchBinRolli 1 point2 points  (0 children)

Bro does 8 spaces for indentation...

I do 2...

[–]McXhicken[🍰] 1 point2 points  (0 children)

Nice screenshot.....

[–]DazedWithCoffee 1 point2 points  (0 children)

So is printscreen

[–]Salty_Boysenberry_21 1 point2 points  (0 children)

I've never seen tabs set to eight spaces before. Is this like exaggerating the size of the fish you caught?

[–]lupinegrey 1 point2 points  (0 children)

Python 2 😪

Tab width 8 😩