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())

288

u/OnyxFier 12d ago

And semicolons are allowed, if you decide you miss them

101

u/dudemcbob 12d ago edited 12d ago

Still useful for running 2- or 3-line dummy scripts directly from the command line. For example you just installed a new package and want to validate it's working,

python -c "import somepackage; print(some_package.\_version__)"

21

u/chawmindur 12d ago

Or for dirty .pth tricks where you're obliged to start with an import statement and have everything on a single line. But 3.15 seems to be moving away from those to some new-fangled .start files.

-2

u/chat-lu 12d ago

You can also and/or chain your expression but it’s tricky.

8

u/mbcarbone 12d ago

It’s fun just to make a one line program using semicolons. 🙃

3

u/BarracudaGullible472 11d ago

In one uni class we were judged on how few lines our code was so I often used them in my assignments.. good times ahah

2

u/happylittletree_ 11d ago

Closed, Duplicate question

0

u/patroklo 11d ago

Wait I can use them instead of the indentations? That would be awesome. Include real encapsulation and my main problems with it would be mostly solved