On Tue, Jan 5, 2010 at 8:45 PM, Phlip <phlip2...@gmail.com> wrote: > > Here's a super easy example: > > { 42: 'forty two' }.get(41, None) > > Because I can supply a default, I can decide what is an error and what > is . > > Now the equivalent in a language that does not enjoy this false "Zen": > > { 42: 'forty two' }[41] # returns None > { 42: 'forty two' }.fetch(41, None) # ibid > { 42: 'forty two' }.fetch(41) # raises an exception
Here's another super easy example. Should {42 : 'forty two'}[41] be treated the same as {41: None}[41] ? In cases where None is a valid result, you can't use it to signal failure. -- http://mail.python.org/mailman/listinfo/python-list