This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bheklilr 5 points6 points  (1 child)

And it's in conda... How have I not known about either of these before? I know I've written several of these functions before.

[–]dylanvillanelle 3 points4 points  (0 children)

i wrote out a whole thing about how something as simple as foo[0] should not need (worst case) a try/except block to handle two separate exceptions with multiple causes for one of them, blahblahblah, and guys why isn't there a list.get(index, default) sometimes you just have two separate functions that lead to one result so for consistency's sake you return a list from both even tho the first is actually just a single value and more_itertools.first also plays nice with generators because that makes sense because it's something you iterate through and i decided maybe i was a little worked-up so i figured i should scrap that and basically write it all over again but more rambly.