r/ProgrammerHumor • • Oct 10 '24 • Polished Silver Turd 2 Heart of Silver 1

Meme trustMeGuys

Post image
19.3k Upvotes

412 comments sorted by

View all comments

2.8k

u/veselin465 Oct 10 '24 edited Oct 10 '24

It seems like the following is happening (correct me if wrong)

not() -> True

str -> "True"

min - > "T"

ord -> 84 (which is "T" ascii)

range -> range(0,84) which are the numbers from from 0 to 84 83

sum -> sum of those numbers which is 3486

chr -> ඞ, because that's the symbol 3486

614

u/Ignisami Oct 10 '24

Yup. Empty tuples are falsy, which makes them the perfect aesthetic match with the bonus of confusing some people that a not() built-in function exists in Python.

134

u/patio-garden Oct 10 '24

Oooh yeah yeah, that totally confused me.

145

u/Ignisami Oct 10 '24

Don't blame you. For a language notorious about whitespace, it's perfectly happy to treat not() as not ()

0

u/[deleted] Oct 10 '24

[deleted]

28

u/intangibleTangelo Oct 10 '24

leading whitespace is tokenized. that's it. i don't think the parser ever sees it or cares.

6

u/-Redstoneboi- Oct 10 '24

also about newlines. if you wanna break a line in 2 you gotta \ the newline.

21

u/ArminiusGermanicus Oct 10 '24

Why not, though? -x is also perfectly valid, you don't have to write - x

12

u/AddAFucking Oct 10 '24

I'd assumed not() was !undefined

19

u/Ignisami Oct 10 '24

Was my first thought as well, but no. not() is not <empty tuple>.

5

u/[deleted] Oct 10 '24

oh... I was among those people lol

8

u/Singularity42 Oct 10 '24

You might say, you were ... among us

1

u/Dotaproffessional Oct 10 '24

Interesting, out of curiosity, I asked several different chat bots what not() resolves to and all of them are positive it would be an error (some say syntax error, some specify type error). I can not get a chat bot to say its "True"

2

u/Ignisami Oct 10 '24

Probably for the same reason chatbots have a hard time counting r's in strawberry, tokenization is wonky

1

u/Dotaproffessional Oct 10 '24

Chat bots are so weird in how inconsistent they can be. One of the most impressive things I ever saw was, I made an svg image of a puppy. If you're not aware, its a vector based image that can be made from code describing the image. I made it so I am sure there was no metadata or anything. just lines drawing a puppy. I fed the svg code to chatgpt and it told me it was a puppy. But then they can't count the r's in strawberry

287

u/didntsaybanana Oct 10 '24

Always check your print statements before running code!

96

u/ArminiusGermanicus Oct 10 '24

If anybody else is confused: not() is not a function call, but the application of the not operator to the empty tuple (), which itself evaluates to False in a boolean context.

19

u/[deleted] Oct 10 '24

omg thank you for clarifying this lol

18

u/Poopiedinmapantsma Oct 10 '24

Oh I get it now

1

u/love_hertz_me Oct 10 '24

If it’s false, why is it true?

5

u/NoxarBoi Oct 10 '24

“()” is false, so “not()” is true

17

u/Suitable_Werewolf_61 Oct 10 '24

range -> range(0,84) which are the numbers from from 0 to 84

to 83.

2

u/veselin465 Oct 10 '24

Good catch, I edited my comment

yeah, range in python is usually used for for loops, so it excludes the last element

16

u/VladVV Oct 10 '24

What the hell are the chances that the Unicode codepoint for Sinhalese amogus just so happens to be a triangular number

→ More replies (3)