On Sun, Feb 14, 2021 at 7:38 AM Wes Turner <wes.tur...@gmail.com> wrote: > > https://awesome-safety-critical.readthedocs.io/en/latest/ > https://awesome-safety-critical.readthedocs.io/en/latest/#software-safety-standards > > What is and is not constant time in Python could be added to structured data > elements in (implementations') docstrings. >
That debate happened a while ago regarding string subscripting. The conclusion was that "happens in constant time" is NOT part of the specification. The Python language stipulates that, when you subscript a string with an integer, you'll get back a single-character string; but it's absolutely acceptable for an implementation to do this in O(n) time under certain circumstances if it chooses. So you're absolutely correct: it would have to be in the *implementations'* docstrings. It's not part of the language. ChrisA _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ERAUSQPWKCHM5IFIBZEXQOT2W2RBGFEN/ Code of Conduct: http://python.org/psf/codeofconduct/