Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Switch back to l
  • Loading branch information
StanFromIreland committed Aug 23, 2026
commit 116f21ec9f82125eeaa19453544e43bdd4716eb9
36 changes: 18 additions & 18 deletions Doc/library/time-complexity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,42 @@ If you need to add or remove at both ends, consider using a

* - Operation
- Complexity
* - Copy (``L.copy()``)
* - Copy (``l.copy()``)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may seem silly, but I would suggest using L instead of l. Even with monospace fonts, it may not necessarily be readable for everyone.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with monospace fonts, it may not necessarily be readable for everyone.

I can see people confusing it with I, but I don't think that's a big issue here. It would however be inconsistent with the other tables, which would bug me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering we are using l[i:j], I still think it's better to have L. It's not an issue to use another capitalization with other tables here. What matters is readability for me. Or you can use v for "vector".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge the list and tuple sections and use s, as in the main documentation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, it was s originally in this PR and later changed at Ned's request. I've updated to L, I don't think merging is correct. Unlike the main docs, this is more of a reference.

- *O*\ (*n*)
* - Append (``L.append(x)``) [1]_
* - Append (``l.append(x)``) [1]_
- *O*\ (1)
* - Pop (``L.pop(k)``) [1]_ [2]_
* - Pop (``l.pop(k)``) [1]_ [2]_
- *O*\ (*n* - *k*)
* - Insert (``L.insert(k, x)``) [1]_ [2]_
* - Insert (``l.insert(k, x)``) [1]_ [2]_
- *O*\ (*n* - *k*)
Comment thread
StanFromIreland marked this conversation as resolved.
* - Get item (``L[k]``)
* - Get item (``l[k]``)
- *O*\ (1)
* - Set item (``L[k] = x``)
* - Set item (``l[k] = x``)
- *O*\ (1)
* - Delete item (``del L[k]``) [2]_
* - Delete item (``del l[k]``) [2]_
- *O*\ (*n* - *k*)
* - Iteration
- *O*\ (*n*)
* - Get slice (``L[i:j]``)
* - Get slice (``l[i:j]``)
- *O*\ (*j* - *i*)
* - Set slice (``L[i:j] = t``) [1]_
* - Set slice (``l[i:j] = t``) [1]_
- *O*\ (*j* - *i*) if len(*t*) == *j* - *i*,
otherwise *O*\ (*n* - *i* + len(*t*))
* - Delete slice (``del L[i:j]``)
* - Delete slice (``del l[i:j]``)
- *O*\ (*n* - *i*)
* - Extend (``L.extend(t)``) [1]_ [3]_
* - Extend (``l.extend(t)``) [1]_ [3]_
- *O*\ (len(*t*))
Comment thread
StanFromIreland marked this conversation as resolved.
* - Sort (``L.sort()``) [4]_
* - Sort (``l.sort()``) [4]_
- *O*\ (*n* log *n*)
* - Concatenate (``L1 + L2``)
- *O*\ (len(*L1*) + len(*L2*))
* - Multiply (``L * k``)
* - Concatenate (``l1 + l2``)
- *O*\ (len(*l1*) + len(*l2*))
* - Multiply (``l * k``)
- *O*\ (*nk*)
* - ``x in L``
* - ``x in l``
- *O*\ (*n*)
* - ``min(L)``, ``max(L)``
* - ``min(l)``, ``max(l)``
- *O*\ (*n*)
* - Get length (``len(L)``) [5]_
* - Get length (``len(l)``) [5]_
- *O*\ (1)

Comment thread
StanFromIreland marked this conversation as resolved.

Expand Down
Loading