Skip to content

Resolved issue #174 by subdividing list idioms and replacing dict w/ set#576

Merged
sigmavirus24 merged 2 commits into
realpython:masterfrom
emilydolson:master
Oct 3, 2015
Merged

Resolved issue #174 by subdividing list idioms and replacing dict w/ set#576
sigmavirus24 merged 2 commits into
realpython:masterfrom
emilydolson:master

Conversation

@emilydolson
Copy link
Copy Markdown
Contributor

As discussed in #174, it's probably preferable to suggest using a set in place of a dictionary with empty values when talking about the benefits of hashtables for search speed, in "Create a length-N list of lists" in the idioms section. It seems like part of the reason dictionaries were originally used there is that this section actually bundles a few related idioms together. For clarity (and to be able to talk about search speed without being forced to use the motivating example of a collection of lists), I split this section into three:

  • Create a length-N list of lists
  • Create a string from a list
  • Searching for an item in a collection

In the "Searching for an item in a collection" section, I replaced the dictionary with a set, and added a brief explanation on the trade-offs between lists and sets/dictionaries, and when you might want to use one vs the other.

I think this should address all of the points raised in issue #174.

Comment thread docs/writing/style.rst Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The under section heading should be the same number of characters as the heading it underlines, e.g.,

Create a string from a list
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some text

Searching for an item in a collection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Other text

Note, I used ^ because GitHub wouldn't render those properly with ~.

@sigmavirus24
Copy link
Copy Markdown
Contributor

A couple notes, otherwise 👍

@emilydolson
Copy link
Copy Markdown
Contributor Author

Good catch. Fixed!

@sigmavirus24
Copy link
Copy Markdown
Contributor

Thanks @emilydolson! ✨ 🍰 ✨

sigmavirus24 added a commit that referenced this pull request Oct 3, 2015
Resolved issue #174 by subdividing list idioms and replacing dict w/ set
@sigmavirus24 sigmavirus24 merged commit fecd5ec into realpython:master Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants