r/ProgrammerHumor 2d ago

Meme pythonFeelsillegal

Post image
6.7k Upvotes

219 comments sorted by

View all comments

1.0k

u/belabacsijolvan 2d ago

theres main() in python

450

u/chawmindur 2d ago

And {} (= dict())

283

u/OnyxFier 2d ago

And semicolons are allowed, if you decide you miss them

100

u/dudemcbob 2d ago edited 2d 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 2d 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.

-1

u/chat-lu 2d ago

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

7

u/mbcarbone 2d ago

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

3

u/BarracudaGullible472 1d 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_ 1d ago

Closed, Duplicate question

0

u/patroklo 2d 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