Skip to content

Conversation

@pr4deepr
Copy link
Contributor

@pr4deepr pr4deepr commented Apr 26, 2019

Addressing #362 to introduce len() built-in python function

@maxim-belkin
Copy link
Contributor

maxim-belkin commented Apr 26, 2019

Could you please restore the 6th episode? It will be deleted from the repo if we merge your PR as is. You can restore the episode with the following commands:

git checkout gh-pages _episodes/06-loops-and-functions.md
git add -u
git commit -m "Restore 06-loops-and-functions.md"
git push your-fork

@pr4deepr
Copy link
Contributor Author

Apologies, its my first time doing this.
Where do I enter these commands? I use the github website for this..

@maxim-belkin
Copy link
Contributor

maxim-belkin commented Apr 27, 2019

Oh, I see... You can't do what I asked for using web interface.
But don't worry -- I'll do that.

Addressing Issue datacarpentry#362:
Ep2: Statistics challenge relies on untaught knowledge datacarpentry#362

Introducing the built-in function len() after the tuple and list section in episode 01
@maxim-belkin maxim-belkin force-pushed the introducing-len()-function branch from 908a53e to 846332c Compare April 27, 2019 19:06
@pr4deepr
Copy link
Contributor Author

pr4deepr commented Apr 27, 2019 via email

@maxim-belkin
Copy link
Contributor

No worries. It was not difficult to fix -- I just was not sure if you wanted to do it yourself or not.
I'll let April (@wrightaprilm) chime in on the content.

My thoughts: the question, if added, should be reformulated as:

"Find the number of elements ("items") in a_list or a_tuple using Python's built-in function len()"

@pr4deepr
Copy link
Contributor Author

pr4deepr commented Apr 28, 2019 via email

@maxim-belkin
Copy link
Contributor

No problem, Pradeep.
Could you please clarify how your contribution adds to the discussion of lists versus tuples?

@pr4deepr
Copy link
Contributor Author

pr4deepr commented May 6, 2019

The idea was to show that the same built-in function can be used for looking at two different data structures, and to introduce the len() function.
It may make sense if either the tuple or list had different number of items. That way, getting the length of a tuple and list will return different values. Is this complicating things in the intro lesson?

@maxim-belkin maxim-belkin requested a review from wrightaprilm May 17, 2019 14:28
@maxim-belkin
Copy link
Contributor

I'm on the fence with regards to this PR. Let me first argue why I think it should not be merged and then on what grounds it can be merged.

NAY: I think that when we're talking about differences (between any two things) it is important to highlight exactly them, not the common things. This way these differences have a better chance of sticking in our minds. len() function can be used for any data type that has __len__ method implemented, so it is not unique to lists-vs-tuples.

AYE: We could, actually, start with the len function instead of finishing with it. The logic would be that we first mention a "common ground" and then discuss differences.

I'll let @wrightaprilm make the final decision.

@wrightaprilm
Copy link
Contributor

I'm also a little bit on the fence - we do introduce built-in functions in this lesson, so I like the idea of having the learners just try another built-in.

And my hesitance isn't about this pull request, per se. One thing that this lesson is kind of weak on is tuples as a data type. The why isn't well explained, and I often skip them for later when I use these materials. What if we edited the question to be about the built-in function? As in "What information does the built-in function len() provide? Does it work provide the same information on both tuples and lists? Does the help() function confirm this?" That way, we're emphasizing that these are both iterable types, just that one is immutable.

@maxim-belkin
Copy link
Contributor

What if we edited the question to be about the built-in function? As in "What information does the built-in function len() provide? Does it work provide the same information on both tuples and lists? Does the help() function confirm this?" That way, we're emphasizing that these are both iterable types, just that one is immutable.

I like that idea.

@maxim-belkin
Copy link
Contributor

Hi, Pradeep! Did you want to update the PR as we discussed above? Do you need any help with that?

What information does the built-in function `len()` provide?
Does it provide the same information on both tuples and lists?
Does the `help()` function confirm this?

@maxim-belkin maxim-belkin removed the request for review from wrightaprilm January 28, 2020 18:46
@maxim-belkin maxim-belkin added type:enhancement Propose enhancement to the lesson status:waiting for response Waiting for Contributor to respond to maintainers' comments or update PR labels Jan 28, 2020
@tobyhodges
Copy link
Member

I'm helping the current lesson Maintainers process outstanding pull requests on this repository, in preparation for transition to the new lesson infrastructure.

@pr4deepr thank you for contributing this suggested change. Reading through the conversation above it seems the former lesson Maintainers settled on a suggestion for how the exercise text could be adjusted to address the issue. If you are still interested in contributing this change, please resolve the conflicts that have been introduced in the intervening years then update the pull request (or close it and open a new one) based on the suggestion above before the end of April. After that, the infrastructure transition will invalidate your fork and we will have to close the PR. Let me know if there's anything I can do to help.

@tobyhodges
Copy link
Member

Closing in favour of #449

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

Labels

status:waiting for response Waiting for Contributor to respond to maintainers' comments or update PR type:enhancement Propose enhancement to the lesson

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants