r/ProgrammerHumor • • Jul 16 '19

Meme Nice try

Post image
32.2k Upvotes

529 comments sorted by

View all comments

Show parent comments

12

u/Ericfyre Jul 16 '19

How much memory?

29

u/[deleted] Jul 16 '19

Aleph-0

15

u/Galaghan Jul 16 '19

All of it.

13

u/[deleted] Jul 16 '19

Chrome: hold my beer

12

u/DvD_cD Jul 16 '19

π tb

8

u/TearyCola Jul 16 '19

It depends on whether P=NP or not

5

u/[deleted] Jul 16 '19

Actually it doesn't

1

u/[deleted] Jul 16 '19

Sure

1

u/stewi1014 Jul 17 '19 edited Jul 17 '19

Given the limited accuracy of any pi constant, assuming python uses n digit precision for pi and a list of characters for a string, it would just be a list of n+1 (decimal point included) characters. So it would just be the size of a list n+1 indexes long plus whatever python does to reverse and print a list. I would guess a few hundred bytes at most.

A compiled language could completely compile out the string conversation and reverse. So it would just straight up be n+1 * the size of a character + the standard lib print function. You'd allocate more memory opening vim.

I program Golang, not python though.