What is the maximum recursion depth in Python, and how to increase it?

It is a guard against a stack overflow, yes. Python (or rather, the CPython implementation) doesn’t optimize tail recursion, and unbridled recursion causes stack overflows. You can check the recursion limit with sys.getrecursionlimit: and change the recursion limit with sys.setrecursionlimit: but doing so is dangerous — the standard limit is a little conservative, but Python … Read more

Remove all whitespace in a string

If you want to remove leading and ending spaces, use str.strip(): If you want to remove all space characters, use str.replace(): (NB this only removes the “normal” ASCII space character ‘ ‘ U+0020 but not any other whitespace) If you want to remove duplicated spaces, use str.split():

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

What is this warning about? Modern CPUs provide a lot of low-level instructions, besides the usual arithmetic and logic, known as extensions, e.g. SSE2, SSE4, AVX, etc. From the Wikipedia: Advanced Vector Extensions (AVX) are extensions to the x86 instruction set architecture for microprocessors from Intel and AMD proposed by Intel in March 2008 and … Read more

What is JSONP, and why was it created?

It’s actually not too complicated… Say you’re on domain example.com, and you want to make a request to domain example.net. To do so, you need to cross domain boundaries, a no-no in most of browserland. The one item that bypasses this limitation is <script> tags. When you use a script tag, the domain limitation is … Read more