Exception as the primary error handling mechanism?

Ben Kaplan bsk16 at case.edu
Wed Jan 6 17:24:39 CET 2010


On 1/6/10 10:12 AM, Phlip wrote:
> On Jan 5, 10:54 pm, Benjamin Kaplan<benjamin.kap... at case.edu>  wrote:
>
>    
>> {41: None}[41] ?
>>
>> In cases where None is a valid result, you can't use it to signal failure.
>>      
> Asked and answered. You change the "sentinel" in .fetch to something
> else.
>    
When did I specify a sentinel value? You're saying that if None is a 
valid value in the dict, you can't use slice syntax for it.

> But y'all keep on defending the language making your programming
> decisions for you!
>    

Your example is the one where the language makes programming decisions 
for you. Your language is deciding that if I use slice syntax, I want 
the sentinel to be None. Python is deciding that unless I give it a 
sentinel, there is no sentinel.



More information about the Python-list mailing list