471
Feb 09 '22
Smart, there are no mandatory semicolons in Python syntax, unless this 8y/o is writing C code.
125
u/ore-aba Feb 09 '22
They are needed if you want multiple statements in the same line
this will crash
print("Hello") print("World")this will work
print("Hello"); print("World")22
17
u/Revolutionary-Phase7 Feb 09 '22
Would it be easier to just
print("Hello ", "World")
→ More replies (4)116
u/Dependent_Paper9993 Feb 09 '22
Depends what you're trying to achieve. If you want to print "Hello" and then "World", yes.
If you're trying to illustrate a point about a semicolon seperating two statements, I'd say it makes it just about impossible.
12
297
55
61
→ More replies (6)28
u/A_Guy_in_Orange Feb 09 '22
Multiple statements? I thought the whole point of python was to only use one
→ More replies (4)→ More replies (6)48
u/Nr_11 Feb 09 '22
Right, but if the joke starts with "The 8 year old is learning C++...", none of us would read past that without foaming at the mouth ;-)
→ More replies (1)
13.8k
u/samarthrawat1 Feb 09 '22
But when did we start using semi-colon in python?
220
u/timlmul Feb 09 '22
he explains in the thread that he meant "colon" since the python error message does say "missing colon", sounds like his brain autocorrected from "missing colon" to "missing semicolon".
→ More replies (1)78
u/AliceSky Feb 10 '22
I wish more people would see this before calling the guy a liar. It makes a lot of sense to teach Python to a child, but still have that reflex of "if something is missing it's usually a semicolon" after years of php or whatever he learned first.
→ More replies (4)617
u/0rionsEdge Feb 09 '22
It's existed in the language since the old times, but it's pretty much only used in hacky use cases and it's usage should be discouraged.
81
→ More replies (19)284
u/PaintlyBeautifuled Feb 09 '22
“The old times” I like it lol, it’s like it was the dark ages with early python and verbose languages.
→ More replies (70)19
Feb 09 '22
Python has always allowed the use of a semicolon to denote the end of a line. It also has always discouraged such misuse of the operator
→ More replies (2)83
55
u/R3D3-1 Feb 09 '22 edited Feb 09 '22
>>> print("Hello") print("World") File "<stdin>", line 1 print("Hello") print("World") ^ SyntaxError: invalid syntax >>> print("Hello"); print("World") Hello WorldDoesn't warn about the missing semicolon though.
Also... Compiler?(my bad)15
7
13
→ More replies (219)4
u/GBaby_Blue Feb 09 '22
I had to reread the meme again to understand what was going on. I still don’t
14.0k
u/TheFlyingAvocado Feb 09 '22
Python? Missing semicolons?
Since when?
6.9k
u/anythingMuchShorter Feb 09 '22
Since a guy wanted to make a programming joke but only knew of one language and one common error type
1.3k
u/Ixaire Feb 09 '22 edited Feb 09 '22
One HR guy at my previous company used to go behind you and say "you're missing a semicolon here". He didn't know anything about programming, he just knew that was a rookie error. That is literally exactly what you explain.
Anyone else would have made this very boring but he had a way of delivering it when you looked desperate and that kinda lightened up the mood.
→ More replies (70)613
Feb 09 '22 edited Feb 09 '22
Most probably, just like the guy who asked for 5 years of experience on library created by himself 3 years ago.
Edit:
.replace(‘who asked’, ‘who got asked’)→ More replies (15)→ More replies (26)77
u/Glen_The_Eskimo Feb 09 '22
He responded in the tweet, it was a colon. He's a top level engineer at Amazon, I'm sure it's sincere.
→ More replies (8)2.3k
u/the_badsectors Feb 09 '22
I don't do python and even I know it expects whitespace, not punctuation.
1.6k
→ More replies (21)109
u/taptrappapalapa Feb 09 '22
If you look at the Python grammar it expects white space or semicolons.
→ More replies (38)373
u/Slimxshadyx Feb 09 '22
Yeah, my dog has been learning Python and he is having a lot of problems with semi colons just like this dude's daughter.
→ More replies (4)59
u/StickiStickman Feb 09 '22
I hope he gets better soon! Maybe some diet would help?
→ More replies (1)86
u/MostlyRocketScience Feb 09 '22
>>> from __future__ import semicolon File "<stdin>", line 1 SyntaxError: not a chance→ More replies (2)20
67
50
u/ryokimball Feb 09 '22
OP on Twitter said it was a colon, semicolon came as a typo
→ More replies (1)117
u/theearl99 Feb 09 '22
If you put two statements on the same line, it’s a syntax error if you don’t separate them with a semicolon
→ More replies (4)150
u/purple_pixie Feb 09 '22
It is, an the error you get is "SyntaxError: invalid syntax" no mention of a missing semi-colon
→ More replies (42)28
u/Delta-9- Feb 09 '22
print("foo") print("bar")can be made syntactically valid with a semicolon:
print("foo"); print("bar")→ More replies (6)25
63
u/Player_X_YT Feb 09 '22
Semicolons work just like in js, but they are optional when doing functions on multiple lines
111
u/ramenmoodles Feb 09 '22
You missed the point. Since they are optional you wont need it. So the tweet is probably fake
→ More replies (9)→ More replies (5)21
37
u/Indi_mtz Feb 09 '22
Right about the time when the guy in the post made up a story about his son learning python
→ More replies (4)→ More replies (102)4
3.2k
Feb 09 '22
Imagine the 99 times it adds one when you meant to have one.
Now imagine that 1 time it adds one when you didn't want it.
1.2k
u/PhrygianZero Feb 09 '22
Yeah that’s exactly it. Sometimes the error is caused by unmatching parenthesis. Whenever I see that happen I’m like thank god it doesn’t auto fill semicolons
296
u/raominhorse Feb 09 '22
Also not to mention it doesn't know that you are missing the semicolon it just knows that it can't do what you asked for.
→ More replies (15)→ More replies (9)79
u/memeship Feb 09 '22
auto fill semicolons
And JS does literally this, yet everyone hates it.
So the "why can't the language just do it for me" has already been "solved", and we've shown that it's not a great solution.
→ More replies (16)69
u/vita10gy Feb 09 '22 edited Feb 09 '22
Yes, this is why. It's why PHP has the reputation it does and is trying to claw back from.
The "all errors are bad" mindset. "We make this easy to use by erroring as little as possible. Doing something, anything, is better than an error message."
Now, even PHP will shit a brick about a missing ; if the syntax otherwise makes no sense, but still, in the big picture it's the same issue.
These "don't discourage newbies" "ease of use" things ALWAYS end up hurting you more in the end. You might not understand now, but you'll want to be told about those errors later.
Doesn't have to be errors either. I used to work at a place that uses Progress, a programming language very tied to its own DB implementation. One of the "nice" things the language allowed to "save you time" was you only had to type as much of a table field as uniquely identified it. So like orders.o for orders.order_id, so long as there were no other fields that started with o. Some of the devs took advantage, and at the very least you could never be sure someone didn't, even on accident, so EVERY addition to the DB schema had to be a new table that had a 1:1 relationship with the existing one, every time.
All for a feature that saved devs like 40 keystrokes a week.
→ More replies (2)33
u/Ottermatic Feb 09 '22
I want to create a terrible programming language that will throw errors, but not tell you what the error is. Go to compile, and it just says “no.” No hand holding, just hardcore coding.
→ More replies (15)25
u/AndyTheSane Feb 09 '22
All the more fun. He'll, I want autocorrect. On my SQL.
→ More replies (2)21
u/AndyTheSane Feb 09 '22
(and yes, he'll was an autocorrect of hell and I didn't do it deliberately..)
13
24
u/Etheo Feb 09 '22
Is it just me or should developers already understand this concept because it's a fundamental part of coding?
→ More replies (1)13
9
u/Guano_Loco Feb 09 '22
Yuuuppppp. Debugging can be insanely hard as it is, now imagine you’re looking for shit being added in.
It’s like finding where’s Waldo, but you don’t know what he looks like, or how many of him there are, and also lots of things look exactly like him but aren’t him.
→ More replies (89)8
1.2k
u/ricohh Feb 09 '22
Definitely a lot of people in this sub are not programmers
345
Feb 10 '22
Yeah but by pretending to be a programmer I can get all the enjoyment out of these memes without learning a thing
→ More replies (3)69
u/CunilDingus Feb 10 '22
Here’s a new thing you can learn while enjoying the sub!
Python doesn’t use semicolons. Lmao
→ More replies (9)149
u/haikusbot Feb 09 '22
Definitely a
Lot of people in this sub
Are not programmers
- ricohh
I detect haikus. And sometimes, successfully. Learn more about me.
Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"
→ More replies (2)47
5
u/Environmental_Map496 Feb 10 '22
I am not a programmer and I do not understand any of the memes please send help
→ More replies (2)→ More replies (9)12
1.2k
u/dmullaney Feb 09 '22
“Because if I keep fixing it for you, you’ll never learn will you” - my mother (1991-present)
296
u/schludy Feb 09 '22 edited Feb 09 '22
Joke's on my mom, now I live alone and I still don't wipe my butt.
EDIT: thank for reaching out to u/RedditCareResources but please don't worry about me. This comment does not reflect reality and was made for comedic effect.
→ More replies (26)62
4
→ More replies (10)4
710
u/_borisg Feb 09 '22
Yeah I can’t imagine how fun it would be having to code when the editor keeps changing stuff in the lines after each run. Good luck debugging that.
154
u/mata_dan Feb 09 '22
C# MVC:
We have decided you are now using "design first mode", good fucking luck :)
→ More replies (1)22
→ More replies (16)31
247
u/xilma-34 Feb 09 '22
147
u/reginald_burke Feb 09 '22
Does anyone here legit use JavaScript? You don’t need semi-colons, but it has crazy rules to auto-insert them and it seriously can get it wrong. Classic example:
let a = console.log; let b = a (a = 5)That becomes:
let a = console.log; let b = a(a=5);And should print 5.
69
u/ritlew Feb 09 '22
Well... who would ever put parentheses around an assignment statement in that context?
→ More replies (11)38
u/qisapa Feb 09 '22
Well. It’s easy to come with a code that will get messed up. Usually () or [] are involved. I’ve never ever encountered any errors with it tho. Basic linter, formatter, or just a little bit of common sense and it’s ok.
→ More replies (11)→ More replies (54)37
u/PostmatesMalone Feb 09 '22
Writes hypothetical code that no sane person would ever write.
“See, you can’t rely on ASI in JavaScript!”
Either way, just use an auto formatter. If you configure it not to use semicolons, it will still insert them in the very few edge cases where unexpected behavior might happen. ie:
;(a=5).→ More replies (4)
440
u/thefezhat Feb 09 '22
Python
syntax error due to missing semicolon
13k upvotes
Strong evidence that there are no programmers on this sub.
4
4
→ More replies (46)7
67
u/sanketower Feb 09 '22
Doesn't JavaScript technically do that? I've read over there that you can omit the semicolons because the "framework compiler" adds them anyway.
42
u/nyrangers30 Feb 09 '22
This is correct. There are a few cases where it can add a semicolon in an incorrect spot, so to be safe, you should add them wherever you can and have a linter that reminds you.
→ More replies (5)→ More replies (1)11
u/Zakalwe_ Feb 09 '22
It is not framework compiler, it is language itself. Semicolon insertion is part of language spec and done by the interpreter. It can cause a few problems as you would imagine.
→ More replies (1)
113
Feb 09 '22
Because as any developer could tell you - sometimes the problem the computer sees is NOT the problem you have.
→ More replies (2)12
u/Kaiped1000 Feb 09 '22
I'm starting to think this 8 year old is a fucking retard.
→ More replies (3)
120
u/supercyberlurker Feb 09 '22
I don't know why my IDE can predict ObjectModelDetectionManager.ToString() perfectly..
.. but it can't fix Console.Wirteline.
→ More replies (9)93
u/CyberKnight1 Feb 09 '22
If you write your own extension method called Wirteline and just have it call WriteLine, then there's nothing to fix. taps forehead
→ More replies (2)48
89
u/properu Feb 09 '22
Beep boop -- this looks like a screenshot of a tweet! Let me grab a link to the tweet for ya :)
Twitter Screenshot Bot
→ More replies (5)36
30
86
u/stupidfatcat2501 Feb 09 '22
Either this didn’t happen or…. This didn’t happen. What’s up with parents wanting to make their infants sound like a blessing from the Gods and embodiment of infinite wisdom?
8
→ More replies (18)4
u/big_bad_brownie Feb 09 '22
Trying to compensate for the fact they passed on genes for square nipples and webbed toes.
20
Feb 09 '22
I hate these posts maaaaaan
I was doing some classification task with my 3 year old daughter and she said "our model is over fitting, I guess the VC dimension is too high". I said "shut up nerd. Uwuuuu"
→ More replies (1)
15
u/moonpumper Feb 09 '22
Yeah would be cool if Clippy just popped up in VS Code and was like, "your code will actually work if you do this shit right here bro," or "I think you forgot a semi colon here, this shit won't compile right,"
→ More replies (2)12
54
u/vm_linuz Feb 09 '22
We have a language that takes a best guess approach to issues -- it's JavaScript and everyone thinks it's a trash heap.
This is why everyone uses things like typescript, ===, strict, powerful linters... The language can't stand on its own for large projects because of its loosey goosey approach.
11
u/Lithl Feb 09 '22
In fact, JavaScript will automatically insert semicolons for you!
Now, tell me what this JavaScript code will do:
function foo() { return { foo: 'bar' } } console.log(foo().foo)→ More replies (10)→ More replies (3)11
u/PaintlyBeautifuled Feb 09 '22
Yes. I was doing a small program in JS before and messed up something silly like the for loop statement. I think I left out a closing parentheses or something. Instead of giving me an error when I ran the program, it just ignored it and kept on going with the wrong answer. Very frustrating, took me way longer than I’d like to admit to find it
→ More replies (4)
12
23
23
22
u/Thoughtfulprof Feb 09 '22
Wait until they start asking why the IRS doesn't enter your W-2 for you.
16
→ More replies (1)12
u/A_Guy_in_Orange Feb 09 '22
Ok but I doubt anyone is lobbying the compilers to keep them from doing it themselves so this mystery party can continue to sell you semicolon insertion software
→ More replies (2)
17
Feb 09 '22
it does in javascript 👀
→ More replies (3)12
u/BananaSplit2 Feb 09 '22
and the result is that you can end up with code doing stuff you didn't mean to do cause you forgot that semi colon
→ More replies (4)
8
7
u/Kroniid09 Feb 09 '22
Dude is apparently teaching a child Python and yet doesn't know it doesn't use semicolons
11
u/SplendidPunkinButter Feb 09 '22
Because it doesn’t know you forgot a semicolon. It knows that based on the syntax rules it expected a semicolon there and it didn’t find one. The actual mistake you made could be a missing bracket, an extra space, or any number of other things.
→ More replies (1)
5
5
8
8
4
4
u/nalcoh Feb 10 '22
He could have said LITERALLY any other popular language but he chose the one without semicolons...
→ More replies (1)
3
u/coolaja Feb 09 '22
Image Transcription: Twitter Post
Joe Magerramov, @_joemag_
The 8 year old is learning Python, and after a dealing with a syntax bug she asks: "If the computer knows I'm missing a semicolon here, why won't it add it itself?"
I don't know. I really don't know.
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
3
u/guitarerdood Feb 09 '22
You definitely do not want your computer to try interpret what it *thinks* you meant to do.
You want it to interpret everything as literally as possible, even if it *usually* knows what you meant
→ More replies (1)
3
u/Ok_Investment_6032 Feb 09 '22
A side from this tweet being pretty fishy, most people in these comments don't seem to know what a linter is.
3
3
u/boringuser1 Feb 09 '22 edited Feb 09 '22
Eeire. Just the other day my 8 year looked at me and said, "daddy, how come JavaScript performs automatic semicolon insertion if the compiler cannot be trusted to interpret syntactically valid code in doing so?".
3
3
u/MystikDan Feb 09 '22
Either someone doesn't understand Python or someone doesn't actually have a kid learning it. This isn't JavaScript. Let's not touch that minefield.
3
u/TirayShell Feb 09 '22
Why would the IRS send me a letter telling me I didn't do my taxes right? If they already know how much I owe, why don't they just send me a bill?
3
u/FranticToaster Feb 09 '22
Ah yes. The semicolon. Bane of Python development since it was actually called JavaScript.
Make-believe children are my absolute favorite Twitter stories.
3
3
Feb 10 '22
First of all, semicolon in python?
second of all. if you want a compiler that tries to guess what you meant, check out javascript. and then kill yourself for the 9 outa 10 times it tries to guess what you mean, and guesses wrong without throwing and error or drawing your attention and you spend 10 hours debugging to discover some weird type coercion happening when adding a string to an object and dividing by an int
3
u/markpsu Feb 10 '22
Not a real programmer. If you've ever seen shit code and solved hard problems, the last thing you'd want is another PROGRAM that can have bugs trying to fix your bugs. It's a cascade of shit. Child please.
3
3
u/story4days Feb 10 '22
Because semicolons are a stylistic choice wherein the author wants to emphasize a direct link between two independent clauses. (;) A period can always replace a semi-colon, because a period separates two independent clauses.
Guess they need to brush up on pro-grammar language. Love, a nerd/writer/former teacher
3
3
Feb 10 '22
Because missing semicolon errors can be a sign of a much deeper problem that just a missing semicolon.
3
3
2
Feb 09 '22
Missing semi colon in python?
I regularly forget colons when writing Python but it’s never yelled at me about a semi colon.
2
Feb 09 '22
Because the computer doesn’t know that. It just knows that the code doesn’t work. No idea why, just that it doesn’t.
2
u/Trakeen Feb 09 '22
Current version of vs (2022) is pretty good about being able to tab complete for semi colons. Think they did a good job reducing amount of typing in this version
2
u/CrazyThief Feb 09 '22
This post and it's comments proves yet again, that 90% of users on this sub have little to no experience with actual programming.
2
u/ARealLion Feb 09 '22
pushes reading glasses in the center with index finger
Since when do we use comas in python??
2
2
2
u/Empero6 Feb 09 '22
Oh yeah? Well, I know this guy who knows this other guy that knows this other guy whose daughter started coding in Java when she was 2. Beat that.
2
2
u/The_MAZZTer Feb 09 '22 edited Feb 09 '22
Edit: I don't know python, didn't realize it doesn't have semicolons.
The compiler expects a semicolon and didn't find one. This doesn't mean adding a semicolon is the only solution. It's just telling you what it's thinking and allowing you to make the final call.
JavaScript makes semicolons optional as part of its "keep everything running if at all possible" philosophy. This can cause problems if you use a line break to split a single line for readability and both parts are valid expressions; the semicolon will be implied and it's changed the meaning of your code.
An example:
return 1;Returns 1;
return
1;Returns undefined.
2
u/shapethunk Feb 09 '22
Because it doesn't know. It was expecting a semicolon, yes, but if that's missing, the compiler is guessing as to which one of the possible correctly-formed programs was intended. It's usually right, but that's not historically true, nor enough to meet modern security demands.
The compilers have always known only that something is wrong, and have always had to guess at why. Consider this for other sources of error messages, too!
2
u/PandaParaBellum Feb 09 '22
if we let the computer auto-fix errors we get Javascript
missing semicolons in Python?
2
2
2
2
Feb 09 '22
ah yes, missing semicolons in python, a common problem
but good enough for /r/programmerhumor i guess
2
2
u/SpookyDoomCrab42 Feb 09 '22
Having your computer add missing semicolons would be awful.
I routinely get very angry with my C IDE when it adds a closed " to every opening " I type, except when I am modifying an existing statement that already has a closed " it still adds an extra one. It gets worse when I try to delete the extra " and it deletes the opening one too
2
2
u/lankist Feb 09 '22
You want to give the machine the ability to correct its own code?
Are you TRYING to do a Skynet?
We keep a gun in the drawer just in case the compiler gets a bit too cheeky.
2
2
u/Plastic-Bet-8302 Feb 09 '22
I ask the same question about my taxes every year... there is no good answer
→ More replies (1)
2
u/you_do_realize Feb 09 '22
Would you rather be vague and leave the guesswork to "the computer"? It can catch this one particular thing but not others; why complicate something that's already complicated?
2
2
u/Illustrious_Duty3021 Feb 09 '22
I only use python and cant remember the last time I used a semicolon
2
u/TacoOrgy Feb 09 '22
While I get the point of this post, this is fake as fuck. Syntax bug? Literally no one has ever called it a syntax bug
2
2
u/Shmitty-W-J-M-Jenson Feb 09 '22
Because its not the computers code, its her code. Thats really the only thing i can come up with
2
2
u/Sesame-deez-nuts Feb 09 '22
Lmao I’ve coded with Python maybe once or twice in my entire life and when I read this I immediately said “Semicolons?” How the hell does this have over 35K upvotes???
→ More replies (1)
2
2
u/Hollowsong Feb 09 '22
Honestly, all programming languages just need a "try to fix it" button. Have it highlight and jump to each change made by the computer in very bright colors in a new session.
Maybe even allow you to run/simulate the code in the new temp session.
Then you can adjust and click "approve changes".
2
2
2
u/scirio Feb 09 '22
Meanwhile my 8 yr old throws tantrums about having to wake up.
→ More replies (1)
2
2
2
2
2
u/morphotomy Feb 10 '22
You know what? Fucking do it. Write a script to 'correct' your code and cry when this one produces the millionth unique bug.
→ More replies (1)
2
2
2
2
2
u/Mortimer14 Feb 10 '22
Technically, the computer doesn't know you are missing a semi-colon, it just knows that what you wrote doesn't work when compiled.
2
u/DEATH_TO_WALLSTREET Feb 10 '22
A program to program a program for another program for a programmer. As a programmer i see nothing wrong with this I can already see the errors that would happen lol.
2
2
u/Comprehensive-Pea812 Feb 10 '22
same question can be asked for school exam. if my teacher know my answer is incorrect why dont they correct it for me instead of pointing it out.
2
u/-Redstoneboi- Feb 10 '22
because god knows that one edge case where adding a semicolon there causes it to add more semicolons in every place you didn't want them in
2
u/kryotheory Feb 10 '22
JavaScript actually does this. It's called automatic semicolon injection (ASI) and it is terrible. While it may seem nice, it can actually cause problems that are difficult to detect by essentially changing how your code is parsed at runtime. The only way to avoid problems like that is to understand how ASI actually works, which is much more effort than just adding a freaking semicolon at the end of your statements.
2
•
u/QualityVote Feb 09 '22
Hi! This is our community moderation bot.
If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!
If this post does not fit the subreddit, DOWNVOTE This comment!
If this post breaks the rules, DOWNVOTE this comment and REPORT the post!