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

Implement nonzero/bool methods to override len #988

Closed
philippjfr opened this Issue Nov 16, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@philippjfr
Copy link
Contributor

commented Nov 16, 2016

Currently when testing any HoloViews object for "truthiness" it uses the __len__ method. In #974 we added the dask interface, which doesn't actually know it's length because it loads the data lazily. Therefore we should implement __nonzero__ (Python 2) and __bool__ (Python 3) methods, which take precedence over the length. Additionally we should confirm that all the code in HoloViews uses the implicit boolean truthiness to check for a zero length element rather than explicitly calling len.

@philippjfr

This comment has been minimized.

Copy link
Contributor Author

commented Nov 29, 2016

Implemented in PR referenced above.

@philippjfr philippjfr closed this Nov 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.