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

add count #71

Merged
merged 2 commits into from
Nov 8, 2013
Merged

add count #71

merged 2 commits into from
Nov 8, 2013

Conversation

mrocklin
Copy link
Member

@mrocklin mrocklin commented Nov 7, 2013

No description provided.

@eriknw
Copy link
Member

eriknw commented Nov 7, 2013

I'm not sure about the name "count", because it may be confused with itertools.count. Also, see:

http://stackoverflow.com/questions/3345785/getting-number-of-elements-in-an-iterator-in-python/15112059#15112059

@eigenhombre
Copy link
Member

+1 for merge if needed soon. I suspect there are optimizations for cases where the type of count's argument is tuple or list. But that can come later.

@eriknw
Copy link
Member

eriknw commented Nov 7, 2013

How about calling it length, since it's a general function that returns the length of iterables/genrators/etc? Another option is ilen since it mimics len, but I prefer length, because it's more clear. And, sure, optimization can come later.

@eigenhombre
Copy link
Member

I'm very used to thinking of count doing what this function does, though I can live w/ length.

@eriknw
Copy link
Member

eriknw commented Nov 7, 2013

Yeah, this behavior of count makes sense to me too, but I think we need to be careful about using the same names as functions in the standard library.

@eriknw
Copy link
Member

eriknw commented Nov 7, 2013

By the way, I am becoming increasingly supportive of count despite my concerns above. Still, it may be a good idea to add something like "not to be confused with itertools.count" in the docstring.

@mrocklin
Copy link
Member Author

mrocklin commented Nov 8, 2013

Added. Merging soon.

mrocklin added a commit that referenced this pull request Nov 8, 2013
@mrocklin mrocklin merged commit 9329a24 into pytoolz:master Nov 8, 2013
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.

None yet

3 participants