The Python Oracle

Why does the interpreter hang when evaluating the expression?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Forest of Spells Looping

--

Chapters
00:00 Why Does The Interpreter Hang When Evaluating The Expression?
00:26 Accepted Answer Score 7
00:45 Thank you

--

Full question
https://stackoverflow.com/questions/2416...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python

#avk47



ACCEPTED ANSWER

Score 7


a is now a really large number and it takes a while to print. Print a in the loop and you'll see it gets really big, this is just a fraction of how large it is if you omit the print, because print takes time to execute. Also, note a=1 always quickly returns 1.