question about True values

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Oct 28 03:28:05 EDT 2006


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?"

Likewise, A < B maps to max(0, B-A).



-- 
Steven.




More information about the Python-list mailing list