Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag updates #2817

Merged
merged 5 commits into from
Dec 31, 2023
Merged

Tag updates #2817

merged 5 commits into from
Dec 31, 2023

Conversation

swfarnsworth
Copy link
Member

This PR updates two tags and introduces a new one about comparisons to True and False.

Regarding the new tag, I'm open to suggestions (and destructive criticism) about using vertical space more sparingly in the code section. I don't like having my_func(user_input) four times, but I'm worried that having ... on the same line as the if statements will be confusing for beginners.

…here on a new line'

Some users mistakenly put the `py` on a different line than the backticks, or put the code on the same line as the `py`. This is intended to subtly prompt readers not to do this.
The previous version began with "Iterating over range-len is a common approach ...", which sounds like an endorsement. Also removed "is guaranteed to produce elements in the same order", as I don't think anyone is actually confused about that. (I wrote the previous version--this is a criticism of my own writing.)
title: "Comparisons to `True` and `False`"
---
It's tempting to think that if statements always need a comparison operator like `==` or `!=`, but this isn't true.
If you're just checking if a value is truthy or falsey, you don't need `== True` or `== False`.
Copy link
Member

Choose a reason for hiding this comment

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

truthy or falsey

Should we expand on what these mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

I lean towards no. It would make the scope of the tag a lot bigger and is not necessarily relevant to the reader. As is, newbies can make an assumption about what they mean and still understand the rest or they can ask what they mean. Either are good outcomes.

Copy link
Contributor

@camcaswell camcaswell left a comment

Choose a reason for hiding this comment

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

👍

bot/resources/tags/codeblock.md Outdated Show resolved Hide resolved
title: "Comparisons to `True` and `False`"
---
It's tempting to think that if statements always need a comparison operator like `==` or `!=`, but this isn't true.
If you're just checking if a value is truthy or falsey, you don't need `== True` or `== False`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I lean towards no. It would make the scope of the tag a lot bigger and is not necessarily relevant to the reader. As is, newbies can make an assumption about what they mean and still understand the rest or they can ask what they mean. Either are good outcomes.

Copy link
Contributor

@wookie184 wookie184 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks

@wookie184 wookie184 enabled auto-merge December 31, 2023 17:17
@wookie184 wookie184 merged commit c1f29b9 into main Dec 31, 2023
5 checks passed
@wookie184 wookie184 deleted the swfarnsworth/tag-updates branch December 31, 2023 17:18
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.

4 participants