DEV Community


Discussion on: TIL: Python Recursion Limit When Accessing Elements in Recursive List

fronkan profile image
Fredrik Bengtsson Author

Interesting! Also a fun fact is that I tried out a similar method in Python using exec and sting multiply.

exec("my_list" + "[1]"*10)

But this actually caused it to hit the recursion error earlier than using the method I used in the post. Although it still went deeper than the limit if I remember correctly. Fyi, to not get board I used string multiply and good ol' copy-paste.