
hello, i'm aware they've been around for quite a while, but for some reason, i did not have the builtins all(seq) and any(seq) on the radar thus far. when i used them today, i just assumed there was a corresponding none(seq), but was surprised to learn that is not true. why is that ? has this been considered ? discussed ? dismissed ? i did search, but the net being neither case-sensitive nor semantic, the results were off topic. sure, i can do not all or not any or any of these: http://stackoverflow.com/q/6518394/217844 http://stackoverflow.com/q/3583860/217844 but none(seq): True if all items in seq are None would IMHO be the pythonic way to do this. what do you think ? # ssc

On Wed, Apr 11, 2012 at 1:22 AM, Steven Samuel Cole <steven.samuel.cole@gmail.com> wrote:
I think it doesn't come up often enough to be worth special casing over the more explicit "all(x is None for x in seq)". Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

If you really mean "if all items in seq are None" then all(x is None for x in seq) is very clear and explicit that you don't mean all(x == None for x in seq) which is not exactly the same thing. If you don't care about exactly being None and you just want falsenes, then not any(seq) works already. If I saw none(seq) I would think it meant "none of seq is true" as that is a more common phrase. You'd need a name like all_none(seq). But then I want any_none() and none_none() too. And all_true() and all_false(), etc. Not enough value here. --- Bruce Follow me: http://www.twitter.com/Vroo http://www.vroospeak.com On Tue, Apr 10, 2012 at 8:22 AM, Steven Samuel Cole < steven.samuel.cole@gmail.com> wrote:

On Tue, Apr 10, 2012 at 6:22 PM, Steven Samuel Cole < steven.samuel.cole@gmail.com> wrote:
.... what do you think ?
I don't like how a missed capitalization can be so deadly. if x is none: return assert x is not none I can see that happening a lot and people being terribly confused and annoyed. Strongly against this idea. Yuval

On Wed, Apr 11, 2012 at 1:22 AM, Steven Samuel Cole <steven.samuel.cole@gmail.com> wrote:
I think it doesn't come up often enough to be worth special casing over the more explicit "all(x is None for x in seq)". Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

If you really mean "if all items in seq are None" then all(x is None for x in seq) is very clear and explicit that you don't mean all(x == None for x in seq) which is not exactly the same thing. If you don't care about exactly being None and you just want falsenes, then not any(seq) works already. If I saw none(seq) I would think it meant "none of seq is true" as that is a more common phrase. You'd need a name like all_none(seq). But then I want any_none() and none_none() too. And all_true() and all_false(), etc. Not enough value here. --- Bruce Follow me: http://www.twitter.com/Vroo http://www.vroospeak.com On Tue, Apr 10, 2012 at 8:22 AM, Steven Samuel Cole < steven.samuel.cole@gmail.com> wrote:

On Tue, Apr 10, 2012 at 6:22 PM, Steven Samuel Cole < steven.samuel.cole@gmail.com> wrote:
.... what do you think ?
I don't like how a missed capitalization can be so deadly. if x is none: return assert x is not none I can see that happening a lot and people being terribly confused and annoyed. Strongly against this idea. Yuval
participants (7)
-
Ben Finney
-
Bruce Leban
-
Matt Joiner
-
Nick Coghlan
-
Oscar Benjamin
-
Steven Samuel Cole
-
Yuval Greenfield