Skip to content

Conversation

@developer0hye
Copy link

More pythonic way to find aind and mind for _summarize function

More pythonic way to find aind and mind for _summarize function
Comment on lines -435 to +436
aind = [i for i, aRng in enumerate(p.areaRngLbl) if aRng == areaRng]
mind = [i for i, mDet in enumerate(p.maxDets) if mDet == maxDets]
aind = p.areaRngLbl.index(areaRng)
mind = p.maxDets.index(maxDets)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That has different semantics though: your code only gives the first match and throws ValueError when nothing matches, whereas the original list allowed for multiple matches and may return an empty list.

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.

2 participants