Some of these don&#x27;t seem quite right. For example, set difference:<p><pre><code>  Difference    | s - t        | O(len(t))     |
</code></pre>
Worst case, we do something like `set(range(1000)) - {1}`; the bulk of this is going to be making a copy of s from which to subtract t, which is O(|s|). (If this were `s -= t`, I&#x27;d agree, O(|t|).) (Same logic applies to the other set operations.)<p><pre><code>  Clear         | d.clear()    | O(1)	     | similar to s = {} or = dict()
</code></pre>
I would actually guess d.clear() is O(|d|) <i>in CPython</i>: you&#x27;re doing to need to deref each item in the dictionary[1]. Similarly, earlier it states,<p><pre><code>  Binding a value to any name is O(1).
</code></pre>
If there&#x27;s already a value stored in the variable that gets unref&#x27;d, leading to more derefs… (though I don&#x27;t know how you&#x27;d express that in O(…); perhaps we might say that it might be a larger constant time than you expect!)<p><pre><code>  Note that for i in range(...) is O(len(...)); so for i in range(1,10) is O(1).
</code></pre>
I feel like O(…) notation&#x27;s purpose in life is to show how an algorithm&#x27;s complexity in time or space responds to changes in its inputs. Saying a constant expression such as `for i in range(1,10)` is &quot;O(1)&quot; somewhat misses the point, I feel, as there aren&#x27;t any real inputs to vary. (As opposed to `for i in range(n)`, where the `n` is an unknown input, and the run time of the loop is going to be O(n).)<p><pre><code>  check ==, !=  | s != t       | O(min(len(s),lent(t))
</code></pre>
(this is for sets again) This one isn&#x27;t wrong, but there&#x27;s an interesting opportunity for the notation here, I feel. CPython keeps track of the set&#x27;s length along with the data internally[2], and checks that prior to iteration over the set[3]; so you <i>could</i> notate this `O(|s|) == O(|t|)` as the worst case. This is because in the worst case, |s| and |t| must be equal; if they&#x27;re not, the internal size comparison fails, and you&#x27;re O(1) (how long to check the sizes). (A lot of language implementations&#x27; set implementations do this I think; in fact, I&#x27;d say most programmers would expect it, because they&#x27;d expect len(a_set) to be O(1).)<p>Also, I think some of these are great examples of just how easy CPython&#x27;s implementation is to read in many cases.<p>[1]: see this, for example: <a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2e8a7f5a056c3006965d&#x2F;Objects&#x2F;dictobject.c#L1355-L1359" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2...</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2e8a7f5a056c3006965d&#x2F;Include&#x2F;setobject.h#L46" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2...</a><p>[3]: <a href="https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2e8a7f5a056c3006965d&#x2F;Objects&#x2F;setobject.c#L1835-L1836" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;cpython&#x2F;blob&#x2F;0eb5f5996feed30ade8c2...</a>