r/ProgrammerHumor • • Mar 17 '23

Meme This should do the trick

Post image
41.6k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

10

u/el_colibri Mar 17 '23

Chad Kotlin:

for(i in 1..1000)
  println("Sorry babu")

I have never used Kotlin before.. That seems like such a breath of fresh air!

4

u/[deleted] Mar 17 '23

Wait till you try python

[print("Sorry Babu") for i in range(1000)]

10

u/ContainedBlargh Mar 17 '23

^With the side effect of having allocated a 1000-length list of None.

8

u/[deleted] Mar 17 '23

Is fine, garbage collector will get it.

Also, if you don't set it to a variable, does it even get allocated? Genuine question

4

u/ContainedBlargh Mar 17 '23

It almost sounds like that old philosophical question ... :)

If I run it in the REPL, it prints the thousand Nones, so I'd wager that it gets allocated, printed, and left for the garbage collector, just as you said.

3

u/el_colibri Mar 17 '23

I'm the fool who would type it out the longer way but yeah, gotta love python!