On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 18:22:28 +0000, Antoon Pardon wrote: > >>>> And how do I express that a number has to be greater than >>>> 100 into a Nothing vs Something dichotomy? Declare all >>>> greater numbers as Something and the rest as Nothing? >>> >>> Well, would you declare numbers less than 100 False? >> >> No but the condition: x > 100, will map all numbers to >> either True or False. Can you provide a condition that will >> provide a mapping to Nothing and Something? Without >> artificially mapping False to Nothing and True to Something? > > A > B maps to max(0, A-B) > > or more verbosely, "Remove B items from A items, stopping when there are > no more items to remove. What is left over? Something or Nothing?"
This mapping no longer works if you are not working with numbers. >>> A = [1,2] >>> B = [3] >>> A > B False >>> max(0, A - B) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unsupported operand type(s) for -: 'list' and 'list' -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list