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

TypeError: reduce() of empty sequence with no initial value #86

Closed
povilasb opened this issue Dec 15, 2016 · 6 comments
Closed

TypeError: reduce() of empty sequence with no initial value #86

povilasb opened this issue Dec 15, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@povilasb
Copy link

from functional import seq
seq([]).reduce(lambda res, n: res + n)

results in

TypeError: reduce() of empty sequence with no initial value

Sequence.reduce() could accept third optional variable "initial value" as python functools.reduce() do.

What do you think? :)

@EntilZha
Copy link
Owner

Thanks for taking the time to open an issue! I agree that this would be useful and reasonable. I'll spend some time this weekend to implement something.

@EntilZha EntilZha self-assigned this Dec 15, 2016
@EntilZha EntilZha modified the milestones: 0.8.0, 1.0.0 Dec 15, 2016
@povilasb
Copy link
Author

povilasb commented Dec 16, 2016 via email

EntilZha added a commit that referenced this issue Dec 21, 2016
Additionally update package info and have run-tests explicitly use
python 2
@EntilZha
Copy link
Owner

@povilasb Finished implementing that in latest commit. I added tests, but would be great to see if it works as you're expecting before closing the issue.

@povilasb
Copy link
Author

povilasb commented Dec 22, 2016 via email

@povilasb
Copy link
Author

Works as expected, thank you :)

@EntilZha
Copy link
Owner

Nice. I'll got ahead and close this then. I'll look to see when I could do a release, but so far this would be the only thing going in. It would be nice to do a release that has a few more improvements in addition to this one.

drachpy pushed a commit to drachpy/PyFunctional that referenced this issue Jan 16, 2019
Additionally update package info and have run-tests explicitly use
python 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants