Skip to content

bpo-33872: Add list elements access complexity - #7728

Closed
andresdelfino wants to merge 5 commits into
python:masterfrom
andresdelfino:patch-2
Closed

andresdelfino wants to merge 5 commits into
python:masterfrom
andresdelfino:patch-2

Conversation

@andresdelfino

@andresdelfino andresdelfino commented Jun 15, 2018 •

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/stdtypes.rst Outdated
Lists are mutable sequences, typically used to store collections of
homogeneous items (where the precise degree of similarity will vary by
application).
application). List elements are accessed with a O(1).

@pablogsal pablogsal Jun 15, 2018 •

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.

Suggestion: "List elements are accessed with O(1) time complexity" or "Accessing list elements has O(1) time complexity".

"List elements are accessed with a O(1)" sounds a bit off to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IMHO, mentioning "time complexity" is definitely an improvement, I'll rephrase, thanks :)

We are not talking much about time complexity in other parts of the documentation. Change it to mimic the intention in the Glossary: avoid the confusion with linked lists.
Comment thread Doc/library/stdtypes.rst Outdated
application).

Despite its name, lists are more akin to arrays in other languages than to
linked lists, since its elements are accessed with time complexity O(1).

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.

Use plural: “their name”, “their elements”, to agree with “lists are”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😅 thanks!

Comment thread Doc/library/stdtypes.rst
homogeneous items (where the precise degree of similarity will vary by
application).

Despite their name, lists are more akin to arrays in other languages than to

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.

“despite their name” seems redundant.
“List” is datastructure independent, abstract word.
For example, C# uses IList and ArrayList for sequence (indexable). And LinkedList for linked list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants