Skip to main content
9 events
when toggle format what by license comment
Jul 28, 2017 at 13:35 history edited Deduplicator CC BY-SA 3.0
added syntax-highlighting
S Jan 9, 2015 at 11:18 history suggested Wolf CC BY-SA 3.0
spellfixes. made clear that the if condition was refered
Jan 9, 2015 at 9:40 review Suggested edits
S Jan 9, 2015 at 11:18
Sep 13, 2011 at 7:33 comment added Lie Ryan @crasic: when I don't expect my readers to know that [] evaluates to False, I prefer doing len([complicated expression producing a list]) == 0, rather than using True if [blah] else False which still requires the reader to know that [] evaluates to False.
Sep 13, 2011 at 7:03 comment added crasic Just to clear my obvious mistake [] != False but [] is False as a when cast to a bool
Sep 13, 2011 at 6:56 comment added crasic @hstoerr its in the comment right below that line. I like to make it explicitly known that we someCondition is a predicate. While its strictly unnecessary, I write a lot of scientific scripts read by people who don't code that much, I personally think its more appropriate to have the extra terseness rather than have my colleagues confused because they don't know that [] == False or some other similar pythonic equivalence that isn't 'always' intuitive. Its basically a way to flag that someCondition is, in fact, a predicate.
Sep 13, 2011 at 6:42 comment added Dr. Hans-Peter Störr Why " lambda p: True if [complicated expression involving p] else False " instead of " lambda p: [complicated expression involving p] " ? 8-)
Sep 13, 2011 at 0:52 history edited crasic CC BY-SA 3.0
added 92 characters in body
Sep 13, 2011 at 0:43 history answered crasic CC BY-SA 3.0