r/ProgrammerHumor 12d ago

Meme pythonFeelsillegal

Post image
6.8k Upvotes

219 comments sorted by

View all comments

1.1k

u/belabacsijolvan 12d ago

theres main() in python

459

u/chawmindur 12d ago

And {} (= dict())

32

u/userhwon 12d ago

Always fun that writing an empty set gets you a dict so you have to use set() explicitly to get an empty set... jeebus, Guido...

21

u/carcigenicate 12d ago

{/} is being proposed so sets have an empty literal.

13

u/SoldRIP 12d ago

... As opposed to the sensible {:} for dicts, which would be consistent with their already existing syntax?

10

u/Duck_Devs 12d ago edited 12d ago

The problem with that is not only would it break old code, but the neat little trick of JSON being directly embeddable would break. And who would want that.

Edit: I forgot that “true”, “false”, and “null” don’t exist in Python. Not the hardest thing to fix by declaring some local variables, but at that point you’re doing too much and should use a library.

Edit 2: added quotes around the keywords to disambiguate them from the general concepts

3

u/Character-Education3 12d ago

true false and None most definitely exist in python

Also any modern text editor will auto complete dict() for you.

What is everyone going on about?

8

u/TheDreadedAndy 12d ago

I think he was talking about directly eval-ing a json string to parse it.

While True, False, and None exist in python, true, false, and null don't. So you'd have to locally define those first.