I agree with others that using sys.setrecursionlimit is the way to go. In the end, that is the reason why sys is part of the Python Standard Library.
In an interactive session, you could set your PYTHONSTARTUP global variable to a file with the necessary python commands, however this would still run the exact same code but just a bit more 'hidden' from the user.
I think that if you'd really like to set this to another value, your only option is to dive deep into the C header files of the cpython source code and custom compile python for your needs.
I have a command-line python package run in the terminal directly (it was not run inside python environment) that often gives me a maximum recursion error. I know the default setting is 1000, and I know you can use the setrecursionlimit() command to change it. However, every time I change it and exit the python environment, the value resets to the default.
My question is, without changing the python package, is there a way I could change the python default recursion depth permanently. I understand this may not be a good practice, so I plan to change it back to 1000 after I finish using the package, which I probably won't need after a week.
Thanks!
how to permanently change the maximum recursion depth in python