-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ENH: add Epoch.__len__ #614
Conversation
LGTM |
@christianmbrodbeck I proposed this one a few months ago and before me someone else did. Both times -1 ... |
please consider #253 |
@dengemann What is the argument against it? Or do you remember the specific PRs? |
see #253 --- bad experiences with dropped bads --- IIRC @agramfort and @mluessi had this before and removed it ... |
Ok, bad-dropped. That's why I added the warning, to be consistent with indexing behavior (which indexes the events and issues a warning). If you think that length should be more restrictive it could raise an error if bads have not been dropped? I still think it would be useful when working with preload=True. |
Throwing an error sounds like the safest behavior to me. We'll see what @agramfort and @mluessi think about it. |
taking the devil's advocate's role: what's a len method that only works conditionally. In my scripts I quite often change preload flags, so I would never use this as it would imply unnecessary conditionals ... |
Yeah, I think that would be a feature and not a bug, in the sense that you wouldn't want the |
... continuing: then this is YGNI? |
Well, I maybe ain't gonna need it, but apparently @christianmbrodbeck has a use case...? |
Please don't get me wrong -- I would like it. Trying to accumulate pros |
I am still not convinced due the conditioning issue raised by @dengemann Should we vote for it, i vote for an exception more than a warning of inaccurate result. Also there is no test. My vote is -0.5 :) |
My vote is 0.0 (indifference). If abstention isn't allowed, I'll go with +0.5. I agree that it should be an exception instead of a warning if they try to get |
Yeah, thinking about it for a few days, subcortically, unconsciously, etc., I'm not opposed to it. If we add an exception that should be fine. In a certain sense that would be pythonic since getting exceptions from invoking len can also happen in the world of builtin types. + 0.5 |
ok fair enough. Let me know when it's an exception so we can merge. |
Made it an exception and added tests. |
thanks ! |
PS: I was +1 for merge as long as it throws an exception as well. |
Consistent with indexing and iteration behavior.