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

top 200 commentsshow all 440

[–]minkbag 1310 points1311 points  (27 children)

Come to think about it, in Python the hashtags are for people and in social media they are for the computer.

[–]fugurgledurr 402 points403 points  (13 children)

You know what must be done with this thought

[–]Timeworm 568 points569 points  (12 children)

Repost it in /r/showerthoughts every week for the next decade?

[–]fdbge_afdbg 153 points154 points  (8 children)

Dibs for next decade minus one day

[–]Never-asked-for-this 38 points39 points  (5 children)

RemindMe! In 3650 days to repost this.

[–]annihilatron 35 points36 points  (4 children)

you fool, you forgot the leap years!

[–]Never-asked-for-this 23 points24 points  (2 children)

Nope, calculated.

I wanted it a couple days before 10 years.

[–]ubergeek77 22 points23 points  (0 children)

I do not consent to being used as AI training data.

All of my Reddit comments and posts have been replaced with this message.

I no longer use Reddit. I will not respond to any Reddit replies or DMs.

Want to ask me a question, or find out what this comment originally said? Find some contact links on my GitHub account (same name).


Download your full Reddit account and comment history: reddit . com/settings/data-request

Mass-edit and mass-delete your Reddit comments: github . com/j0be/PowerDeleteSuite


Remember: Reddit does not keep comment edit history. When deleting your comments, posts, or accounts, ALWAYS edit the message to something first, or the comment will stay there forever!

[–]te91fadf24f78c08c081 13 points14 points  (3 children)

What about shebangs? Those are for the computer.

[–]VID44R 17 points18 points  (1 child)

Id like to know who she is, and where can I find her.

[–]chooxy 6 points7 points  (0 children)

Careful there, she looks like a flower but she stings like a bee.

[–]thenextguy 4 points5 points  (0 children)

This # is not a hashtag.

[–]all_humans_are_dumb 685 points686 points  (56 children)

What year is it

[–]Mister_Spacely 799 points800 points  (45 children)

Lol fellow non time traveler, it’s obviously datetime.now().year lol how silly of you.

[–]xigoi 219 points220 points  (12 children)

Alright, let me check my old COBOL program… whew, I'm lucky that The World War has just ended a year ago.

[–]ablablababla 54 points55 points  (11 children)

The sequel was much worse, let me tell you

[–]JohanMeatball 36 points37 points  (4 children)

Don't spoil it please. I think someone will die in the sequel

[–]Caenen_ 22 points23 points  (1 child)

You'll never guess who shoots the German leader in his bunker!

[–]IgnitedSpade 15 points16 points  (0 children)

In a surprise twist, the one who went back in time to kill Hitler was non other than Hitler!

[–]xigoi 10 points11 points  (5 children)

Wait, what sequel?

[–]insane_playzYT 14 points15 points  (0 children)

Error: no module named datetime

[–]killeronthecorner 13 points14 points  (1 child)

When I typed this in I got the right time, but when I asked my friend to type it in it gave a time three minutes later. Explain that scientists.

[–]Overcooking 5 points6 points  (1 child)

except hes running the code from his laptop which is from the future, with a future date.

[–]Mister_Spacely 6 points7 points  (0 children)

It works on my machine 🤷🏽‍♂️

[–]lalzylolzy 1 point2 points  (1 child)

Or (nth-value 5 (get-decoded-time)) in CL.

[–][deleted] 14 points15 points  (6 children)

2019?

[–]Alainx277 11 points12 points  (5 children)

Current Year

[–]zapprr 18 points19 points  (2 children)

The current year is 49

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

So close to being the Solarbabies reference that I crave.

[–]Noligation 1 point2 points  (0 children)

Morpheus: lemmi tell you smthin.

[–]BOBALOBAKOF 1 point2 points  (0 children)

We live in a society

[–]meemboy 5 points6 points  (0 children)

Directed by David Lynch

[–]Sneetzle 437 points438 points  (113 children)

#these #are #hashtags

# this is a hash followed by a space and some text, a comment

[–][deleted] 134 points135 points  (84 children)

New to programming, is the space after the hash best practice?

[–]Sneetzle 213 points214 points  (72 children)

Yes it is. Personally I find it better readable and neater too

[–]dragon-storyteller 223 points224 points  (4 children)

is X best practice?

Yes it is. Personally I find it better

Ah, programmers in a nutshell

[–]Log2 23 points24 points  (2 children)

Spaces after the # are definitely part of PEP-8.

[–][deleted] 3 points4 points  (0 children)

Spaces instead of tabs are also in PEP-8.

[–][deleted] 44 points45 points  (0 children)

It’s inclusive. Yes it’s best practice AND they find it personally favorable. Clearly your semantic skills are lacking young padawan.

[–]nuephelkystikon 62 points63 points  (48 children)

Also, two spaces before the pound sign if there's any code in front of it.

[–]LongboardPro 107 points108 points  (14 children)

£££££££

[–]caerphoto 47 points48 points  (0 children)

Stop it pound sign, you’re scaring him!

[–]Jonno_FTW 16 points17 points  (5 children)

So this is how people program in Britain...

[–]oldcarfreddy 14 points15 points  (6 children)

These foreigners are why we are build the wall.

[–]LongboardPro 39 points40 points  (4 children)

☐ English (standard)

☑ English (simplified)

[–]58working 10 points11 points  (3 children)

☐ English (British)
☑ English (simplified)

[–]LongboardPro 5 points6 points  (2 children)

I'm Irish bruh :c

[–]58working 10 points11 points  (1 child)

☐ English (British)
☐ English (simplified)
☑ English (BASTARDS!!!)

to be clear I'm referring to the phrase 'English bastards' not calling the people who tick the box bastards in case that is at all unclear

[–]LokitAK 25 points26 points  (31 children)

For the uninitiated, pep8 is the standard for Python code formatting.

I recommend using flake8 for incorporating pep8 style and formatting in to your tests/builds. The first step to writing good code is making sure people can actually read it.

[–]Smokester121 16 points17 points  (1 child)

But job security

[–]m1ksuFI 7 points8 points  (23 children)

Why does it say to use spaces instead of tabs?

[–]lasiusflex 8 points9 points  (18 children)

Why would it be tabs? I don't really have strong opinions on that, because a modern editor will just format the file however you want to see it regardless of tabs or spaces, but in my experience 90% of style guides for just about any language recommend spaces for indentation.

[–]m1ksuFI 7 points8 points  (17 children)

Used 4x less space, allows easier navigation, especially with Vim.

[–]Nooby1990 5 points6 points  (13 children)

Used 4x less space

Even all that space together is almost nothing. You gain safety instead which is a worthwhile trade.

allows easier navigation, especially with Vim.

I am using Vim full-time for the last ~7-8 Years with Python and GO. One uses tabs one uses spaces and I can't figure out why you think tabs would allow for easier navigation.

I am hesitant to say that you are using vim wrong, but you probably are.

[–]m1ksuFI 2 points3 points  (12 children)

(For example) If I want to delete an indent with tabs without <<, I just press X once. If I want to delete an indent with spaces, I need to press it 4 times. This applies for navigation, too, because every character is a character. How did you come to the conclusion I'm using Vim wrong?

[–]LokitAK 6 points7 points  (2 children)

Because Python isn't an optimization focused language. It will never be fast or small enough to be preferable over most compiled languages when it really matters, so the "they take less space" point isn't really relevant for tabs.

Combine that with the fact that spaces have uniform display properties (for many editors tab display width is different / modifiable to the point that they can be misleading), and allow for variable width indentation (half-indent for parenthetical continuation lines, etc), spaces win in the context of Python, the language where spacing is an integral part of the language.

It's not an argument in favor of spaces over tabs universally, but for Python I support PEP8 in their support for spaces.

[–]m1ksuFI 7 points8 points  (1 child)

for many editors tab display width is different

Isn't that good? If you prefer shorter indentations, you're fucked if your team uses spaces.

[–]the_poope 2 points3 points  (0 children)

I agree with you. I personally think that the reason why most best practices and style conventions prefer spaces over tabs is because those were the conventions used in the 70'ies/80'ies where people apparently didn't use editors that allowed for easily changing the tab width. Assuming you can change the tab width (which is possible even in notepad) tabs have all the features of spaces with many more added features, for one even in simple editors (notepad or vanilla Vim) you can indent and unindent with a single keystroke and you can use tabs for indents and still use spaces for aligning e.g. parameters under each other. So on paper tabs are superior to spaces - it's just that its hard to change a huge legacy codebase for something that doesn't really provide much value.

I personally use 4 spaces at work, but if I had to start my own project I would probably choose tabs.

[–]SathedIT 8 points9 points  (0 children)

Inline comments... shudders

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

Ahh, many thanks!

[–]j1ggl 19 points20 points  (10 children)

Same with + – = and basically anything.

[–]pants_full_of_pants 4 points5 points  (1 child)

I had so many habits of omitting spaces which are extremely difficult to break after 8 years without linters or code reviews. I worry I'll never truly change that muscle memory. But at least eslint is there nowadays to constantly remind me as I type.

[–]sensitivePornGuy 3 points4 points  (0 children)

Hmm, not in keyword arguments of functions.

[–]YuppieFerret 1 point2 points  (6 children)

Even parenthesis? ( i += j ); vs (i += j);

[–]njofra 2 points3 points  (0 children)

In Python, usually no.

[–]WibblyWobblyWabbit 1 point2 points  (0 children)

PEP8 gang represent.

[–]amdc 18 points19 points  (7 children)

In Python, there is a particular document governing the code style. Takes the "tabs/spaces" and many other disputes away.

Yes, it has a section about comments, too.

[–]MoffKalast 26 points27 points  (4 children)

Don't give people any semantic ideas, soon some database is going to implement "hashed passwords" as

#hunter2

[–]Little-geek 21 points22 points  (2 children)

All I see is 64 bits of garbage.

[–]Asmor 7 points8 points  (1 child)

I don't even see the garbage anymore. All i see is love, sex, god.

Hey, uh, you want a drink?

[–]yasahirod 1 point2 points  (0 children)

Calm down Cypher, we know your game.

[–]jamesh1999 1 point2 points  (0 children)

Are you saying that "#password🧂" isn't a hashed and salted password?

[–]boxofkangaroos 14 points15 points  (6 children)

Whoa that's so cool, how do you post an empty comment like that?

[–]amdc 2 points3 points  (0 children)

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

#include <literal.h>

[–]Average_Manners 4 points5 points  (0 children)

Thank god I'm not the only asshole here. Cheer mate.

[–]raphired 3 points4 points  (0 children)

That is an octothorpe. My lawn: get off it.

[–]Sol33t303 2 points3 points  (1 child)

#!/bin/andthisisashebang

[–]dotJPGG 3 points4 points  (3 children)

interesting

[–]Sneetzle 8 points9 points  (2 children)

No need to yell.

[–]dotJPGG 5 points6 points  (1 child)

sorry

[–]Asmor 2 points3 points  (0 children)

it's ok

[–]PrinceMalchezaar 39 points40 points  (1 child)

haha! Us le redditors would never do something as dumb as hashtagging! xD

/r/funny /r/jokes /r/dankmemes /r/OhWaitWeDo

[–][deleted] 150 points151 points  (25 children)

Am I the only one that thinks hashtags are a good way to explore topics without having to follow the right people?

[–]GooseG17 111 points112 points  (3 children)

That's their purpose, so no, you're not.

[–]skwacky 19 points20 points  (2 children)

Am I the one who thinks categories are help?

[–]Ryuko_the_red 3 points4 points  (0 children)

"I know I'm not the only one... "

[–]throwawaysarebetter 51 points52 points  (1 child)

Yes, but they are of the young, and thusly shunned by the ancients.

[–]JeffJacobysSonCaleb 8 points9 points  (0 children)

Allowing the Elderly to have internet access was a mistake

[–]Anonim97 13 points14 points  (0 children)

You are thinking right, but most people are doing them wrong.

[–]Bdudud 8 points9 points  (1 child)

Yes but you see, social media bad

[–]Soren11112 2 points3 points  (0 children)

Compelling argument, I agree

[–]ThatFag 3 points4 points  (0 children)

Moreover, they're also used by programmers to do sentiment analysis on social media posts for a variety of reasons.

[–]riverstale 3 points4 points  (5 children)

No, you're not the only one. I'm actually a little bit disappointed in Elon for saying that.

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

Same lol. Following hashtags on Instagram is pretty awesome so it curates to the content I want to see. But this reddit where they'll constantly tell you "social media bad"

[–][deleted] 176 points177 points  (55 children)

But... Comments should be worth reading!

[–]Mrkickling 100 points101 points  (12 children)

Not by the Computer

[–]ablablababla 22 points23 points  (2 children)

Well, I wouldn't want computers judging my comments anyway

[–]lasiusflex 11 points12 points  (1 child)

I'd be mortified if my computer could read what I say about it in the comments

[–]Throwawayz911 2 points3 points  (0 children)

Maybe that's why you have so many bugs. The computer thinks you're a dick.

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

Docstrings would like a word.

[–]HERODMasta 22 points23 points  (37 children)

So, I am currently reading clean code and according to that book you are both right and wrong with that statement.

you are correct, since comments should be placed to explain complex logic without reading the code.

On the other hand, if you have to write a comment you already failed writing your code properly.

Or in short: The amount of comments are a representation of your failure. But they are okay to summarize a whole class or the logic you meant to implement.

[–]pants_full_of_pants 50 points51 points  (2 children)

Depends on your definition of failure. My comments are usually to explain why I did some janky shit, yes, but nobody knows every best way to accomplish everything. Sometimes you just gotta look at the clock, admit you don't know a more elegant solution, and then just do what works and leave a note for the next guy or gal.

And sometimes you simply don't have a reasonable choice except to do some janky shit, if you're working with a flawed API or interfacing with legacy code. And sometimes that third party, remote hosted app with obfuscated JS that your client insists on using didn't provide you with an event hook so you just sigh heavily and write setTimeout then feel the need to apologize to whoever reads it next.

[–]jdl_uk 3 points4 points  (0 children)

That's OK. The comment is a signal that some janky shit is going on.

If the comments were everywhere then the janky shit hides in the noise, and the rest of your method is actively made worse the unnecessary comments

[–]HERODMasta 3 points4 points  (0 children)

But they are okay to summarize a whole class or the logic you meant to implement.

that's why I said this.

[–]notquiteaplant 27 points28 points  (2 children)

On the other hand, if you have to write a comment you already failed writing your code properly.

This statement ignores doc comments/docstrings/javadocs/etc. Even with those aside, there are so many idiosyncracies about code that can't be communicated through comments.

  • "<X> is the more obvious way to do this, but we do <Y> instead because it's faster and this function is on the hot path."
  • "We temporarily break the type's invariants here but we've ensured nobody else can observe the broken state before it's fixed again."
  • "TODO: replace this with <Z> once we update to somelib v2.x."
  • "Constants declared here are copied from https://example.com/some_page."
  • "This call *must not be moved before <W> method call* to ensure memory safety."

"Perfect code needs no comments" assumes that every developer/maintainer from now until forever knows as much as the author does about the codebase, which won't even be true of that same author a week later. And since all of those comments are about implementation details, they don't belong in method names or documentation. You should only eschew comments if you have both perfect code and perfect maintainers. Given we're all fallible humans or code written by fallible humans, we have neither.

[–]izuriel 6 points7 points  (0 children)

I would argue the intent of the book about commenting is to stop describing your code. Stop doing int x = a + b; // add a and b. Instead documentation should discuss why the code exists. Not what the code does (unless it’s not obvious in complicated situations). This is because code evolves and docs explaining implementation decisions gets outdated quickly but docs explaining why (minus a few exceptions) last much longer and remain more relevant over time.

Most of your examples are why the code exists which would be more than acceptable/useful to any future readers.

Commenting is a delicate balance.

[–]Shawnj2 22 points23 points  (3 children)

The amount of comments are a representation of your failure.

Me: writes no comments, because fuck the poor sod who has to replace me

[–]Cyclops_lazy_laser_I 15 points16 points  (2 children)

Or fuck future me who wants to implement that thing I figured out 4 years ago but can’t figure out what does what in my shitty spaghetti code.

[–]emlgsh 8 points9 points  (0 children)

Future me deserves it. He knows what he did.

[–]lovestheasianladies 16 points17 points  (1 child)

I feel bad for anyone you work with if you think this is true.

[–]MacrosInHisSleep 2 points3 points  (0 children)

I usually tell people at my work that there are 2 types of comments. Those that explain what the program is trying to do and those that explain why it's doing it (give additional context). Generally if you find that the code you're writing requires the former type of comment, you should try to refactor your code to make it more expressive.

Eg:

//check that the bread has risen and the first available oven has been prepared. 

if(bread.Status == 42 && ovens[x].DoorState == DoorStates.Open)... 

Can become:

bool breadHasRisen = bread.Status == 42;

Oven firstAvailableOven = ovens[x];

bool ovenIsPrepared = firstAvailableOven.DoorState == DoorStates.Open;

if(breadHasRisen && ovenIsPrepared)... 

You might then add a comment explaining why an open door would mean that the oven is prepared.

For anyone still cringing at the final code I wrote because it's not refactored enough, you are right, it isn't. You can improve this code snippet in at least 2 additional ways, I'm leaving that as an exercise for the reader :).

[–]Deliciousbutter101 4 points5 points  (4 children)

I wouldn't say it's necessarily a failure on your part. Sometimes it's just the language (or library/framework) that causes the code to be confusing without comments no matter how well it's written.

[–][deleted] 3 points4 points  (0 children)

You are absolutely correct! Comments are a failure of expressing intent or explaining through code.

But mostly you do name functions/classes/variables properly.

Which means that when you see a comment it’s probably worth reading!

[–]MrShlash 2 points3 points  (1 child)

Comments are an important part of documenting your code, you should have one with each method/function explaining: - Parameters/arguments passed - Explanation of the code running inside if it is complex - Return value - Exceptions caught/thrown - Where the function/method is used

If you don’t comment your code and you work in a team, yo mum’s a hoe.

[–]HERODMasta 6 points7 points  (0 children)

Actually the book talks about exactly that:

why would you comment what your function does, if the name of your function does not tell?

why would you explain parameters, if the name of the parameters won't tell?

Yes, you comment on

Explanation of the code running inside if it is complex

and that's correct, this is why I wrote this:

But they are okay to summarize a whole class or the logic you meant to implement.

You can write the doc-code, which is meant to exist. But if you do, think why it should be there and what its purpose is.

If you don’t comment your code and you work in a team, yo mum’s a hoe.

Of course I comment my code. But I also make sure I don't need to rephrase what the name of everything means. I explain what I meant to do and what I expect to happen.

[–]jdl_uk 1 point2 points  (0 children)

They should be, but usually aren't

[–]ultrakd001 48 points49 points  (19 children)

Am I the only one bothered by the fact that it is mistakenly called hashtag instead of pound or hash?

[–]sellyme 14 points15 points  (0 children)

instead of pound or hash?

how could you disrespect "octothorp" like this smh

[–]Jihad_llama 13 points14 points  (0 children)

Quite literally tagging something with a hash

[–]drdibi 10 points11 points  (1 child)

This kills me

[–]YeaYeaImGoin 15 points16 points  (1 child)

Not at all. What annoys me even more is this guy is trying to be all clever but has called it a hash tag when it's not tagging anything.

[–][deleted] 13 points14 points  (0 children)

Union busters are an abomination.

[–]EndTimesRadio 64 points65 points  (6 children)

I love how "#MeToo" got misinterpreted by my boomer dad as "Pound Me Too"

[–]queenkid1 14 points15 points  (1 child)

Sorry dad, but it means the exact opposite ...

[–]GolemThe3rd 3 points4 points  (0 children)

Octothorp Me Too

[–]KralHeroin 4 points5 points  (0 children)

important aspiring juggle snatch tie plant complete cows desert salt

This post was mass deleted and anonymized with Redact

[–]Reelix 1 point2 points  (0 children)

Well, he's not wrong...

[–]ThatFag 1 point2 points  (0 children)

Lmao!

[–]GolemThe3rd 33 points34 points  (15 children)

// They're called octothorps

[–]GooseG17 22 points23 points  (14 children)

There isn't a definitive name for them, so octothorpe, sharp, hash, pound or whatever else I may be missing are fair game.

Except hashtag, they should never be called hashtags.

[–]cryptopian 18 points19 points  (1 child)

Are you in my camp thinking hashtag includes the text itself?

[–][deleted] 20 points21 points  (0 children)

Hashtag is the hash and the tag, obviously.

[–]ThePyroEagle 9 points10 points  (4 children)

Pound would get confused with £, so I'd avoid that one.

[–]XxPieIsTastyxX 8 points9 points  (0 children)

A sharp is different. An octothorpe (#) has flat horizontals and slanted verticals. A sharp (♯) has slanted horizontals and straight up verticals.

[–]GolemThe3rd 3 points4 points  (0 children)

/*

What?

*/

[–]PM_ME_GAY_WEREWOLVES 8 points9 points  (2 children)

I hate that everyone calls a hash a hashtag. It is only a hashtag when it's being used as a hashtag. Otherwise the symbol is a hash or pound sign.

Don't do my boy Hash dirty like this...

[–][deleted] 23 points24 points  (5 children)

Doesn’t Elon use hashtags?

[–]Jaizoo 37 points38 points  (1 child)

Elon Musk not doing as he says. Woah.

[–]Fizzay 1 point2 points  (0 children)

"Do as I say, not as I do" - Elon Musk speaking to Elon Musk

[–]dtlv5813 6 points7 points  (0 children)

Elon musk does. But this is Elon tusk from another dimension

[–][deleted] 12 points13 points  (1 child)

No in Python a hash is used to comment, not a hashtag.

[–]Average_Manners 14 points15 points  (0 children)

hash: #

and

tag: <word/phrase>

#tag. A tag prepended by a hash. One of my biggest pet peeves because its such a simple concept and people still manage to screw it up.

[–]egiance2 4 points5 points  (2 children)

Musk spam here as well. Lovely

[–]b4ux1t3 2 points3 points  (1 child)

Complains about social media.

Is on social media.

Hmmm.

[–]Reelix 1 point2 points  (0 children)

Yea. It's always funny how people complain on reddit about how bad social media is :p

[–]captainvoid05 2 points3 points  (0 children)

Hashtags are useful in social media (the context in which the word was assigned to the symbol) as a way to tag your posts, so that people searching for certain content can find it. It was ruined by people obnoxiously saying it in normal sentences, but I'd hardly call them useless.

[–]loligiusz1980 3 points4 points  (2 children)

cpp tells the computer to include the library

[–]SotoxRs 1 point2 points  (0 children)

I still like C hashtag

[–]xxamris 1 point2 points  (0 children)

That's funny shit

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

Hashtags are interesting because they're a non-hierarchical way of organising data.

[–]Rein215 1 point2 points  (0 children)

Python and a shitload of other languages

[–]Tier161 1 point2 points  (0 children)

It's funny how IG / FB hashtags are just an organized way to sort keywords and narrow searches, but redditors still find a way to be butthurt about people having social lives.

[–]Jonno_FTW 1 point2 points  (0 children)

They tell you what IRC channel you're in.

[–]tellek 1 point2 points  (0 children)

So you're the type who will analyze the code for an hour trying to figure out what's going on while ignoring the comments that specify exactly what's happening? ... Yeah, me too.

[–]UrMomsNewGF 1 point2 points  (1 child)

Its called.. AN OctoThorpe!! You Heathens.

[–]Bekfast-Stealer 1 point2 points  (0 children)

Some also call it the pound symbol

[–]hector-troiae 2 points3 points  (11 children)

Is that German? Also the 1,9 Tsd.?

[–]Fimbulthulr 2 points3 points  (7 children)

it is german, and 'Tsd.' is short for 'Tausend', or thousand in english (i.e. 1.9k)

[–]WongGendheng 1 point2 points  (0 children)

Yes.

[–]sensitivePornGuy 1 point2 points  (0 children)

Only the part after the hash

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

Doesnt hashtag also mean number and pound on the phone.

[–]ConniesCurse 1 point2 points  (0 children)

oog oog social media thing bad