Skip to content

Add range-len tag#1035

Merged
Den4200 merged 4 commits into
masterfrom
range-len-message
Jul 10, 2020
Merged

Add range-len tag#1035
Den4200 merged 4 commits into
masterfrom
range-len-message

Conversation

@swfarnsworth
Copy link
Copy Markdown
Contributor

This would be a message we could whip out when we see range(len(...)) for loops during help sessions. I intentionally left out a lot of interesting details to keep the message concise.

I recall there being a RealPython article about "pythonic loops" and was hoping to link to it, but it looks like it's now paid content. I saw that our guides are under construction and I'd be happy to write a guide on loops with an emphasis on pythonicness.

I don't know that linking to the official Python docs is a digestible resource for some learners, especially those who don't have experience in other languages, so I'm very much open to alternatives for those.

@swfarnsworth swfarnsworth requested a review from a team as a code owner July 9, 2020 14:57
@swfarnsworth swfarnsworth requested review from Den4200 and eivl and removed request for a team July 9, 2020 14:57
@ghost ghost added the needs 2 approvals label Jul 9, 2020
@ghost
Copy link
Copy Markdown

ghost commented Jul 9, 2020

Thank you for contributing to Python Discord!

Please check out the following documents:

Removed all blank lines to improve how it's rendered on Discord; thanks @kwzrd for rendering this!
@kwzrd kwzrd added a: tags Related to bot tags p: 2 - normal Normal Priority t: feature New feature or request labels Jul 9, 2020
Copy link
Copy Markdown
Contributor

@kwzrd kwzrd left a comment

Choose a reason for hiding this comment

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

Here's what the tag ends up looking like in Discord:

image

I think this is well written and I'm happy to approve it.


Some tags that we have will show an interactive session to demonstrate what the output looks like, for example:

image

This gives a more tangible example of the discussed practices, but it comes at the cost of making the embed (perhaps needlessly) bigger. I don't mind either way, I'm happy with the current approach, just wanted to mention this in case you end up preferring it.

Either way, good job!

@kwzrd kwzrd changed the title Range len message Add range-len tag Jul 9, 2020
@swfarnsworth
Copy link
Copy Markdown
Contributor Author

@kwzrd I see what you're saying about displaying the REPL output. I think people who use range(len(...)) are familiar with iteration in general (and probably use it that way in a C-style language); if the concept of iteration itself is where they're struggling, they probably don't know why they have range(len(...)) in their code, and a tailored approach would be needed to teach them that concept. If we find that the current message isn't effective, we could see if a REPL display is what would trigger the aha moment for them.

@Den4200
Copy link
Copy Markdown
Member

Den4200 commented Jul 9, 2020

Looks good! However, since we do have !zip and !enumerate tags, maybe they could be mentioned in this tag?

@swfarnsworth
Copy link
Copy Markdown
Contributor Author

@Den4200 Do we have any other messages that suggest that you run a command to get another message? The idea sounds a bit weird to me, but our messages would probably be more informative for our intended audience than the Python docs.

Copy link
Copy Markdown
Member

@Den4200 Den4200 left a comment

Choose a reason for hiding this comment

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

Hmm, I don't think there are any tags that mention other ones. It's just the docs from what I can tell, so I'll leave it up to you to decide.

@ghost ghost removed the needs 1 approval label Jul 10, 2020
@Den4200
Copy link
Copy Markdown
Member

Den4200 commented Jul 10, 2020

After some discussion in #organisation, it looks like the tag is ready to go.

@Den4200 Den4200 merged commit a2221b8 into master Jul 10, 2020
@Den4200 Den4200 deleted the range-len-message branch July 10, 2020 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tags Related to bot tags p: 2 - normal Normal Priority t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants