Is there any Python complexity reference? In cppreference, for example, for many functions (such as std::array::size or std::array::fill) there's a complexity section which describes their running complexity, in terms of linear in the size of the container or constant.
I would expect the same information to appear in the python website, perhaps, at least for the CPython implementation. For example, in the list reference, in list.insert I would expect to see complexity: linear; I know this case (and many other container-related operations) is covered here, but many other cases are not. Here are a few examples:
- What is the complexity of
tuple.__le__? It seems like when comparing two tuples of sizen,k, the complexity is aboutO(min(n,k))(however, for smalln's it looks different). - What is the complexity of
random.shuffle? It appears to beO(n). It also appears that the complexity ofrandom.randintisO(1). - What is the complexity of the
__format__method of strings? It appears to be linear in the size of the input string; however, it also grows when the number of relevant arguments grow (compare("{0}"*100000).format(*(("abc",)*100000))with("{}"*100000).format(*(("abc",)*100000))).
I'm aware that (a) each of these questions may be answered by itself, (b) one may look at the code of these modules (even though some are written in C), and (c) StackExchange is not a python mailing list for user requests. So: this is not a doc-feature request, just a question of two parts:
- Do you know if such a resource exists?
- If not, do you know what is the place to ask for such, or can you suggest why I don't need such?
off-site resource