The Samurai Principle

Benjamin Kaplan benjamin.kaplan at
Wed Sep 8 01:38:13 CEST 2010

On Tue, Sep 7, 2010 at 6:20 PM, Phlip <phlip2005 at> wrote:
> On Sep 7, 1:06 pm, Bruno Desthuilliers
> <bdesth.quelquech... at> wrote:
>> try:
>>    return Model.objects.get(pk=42)
>> except Model.DoesNotExist:
>>    return sentinel
> Visual Basic Classic had a Collection Class, which worked essentially
> like a real language's Hash, Map, or Dict.
> Except - it had no operation to test membership. It also could not
> enumerate by key and value (which would be 'for k,v in dict.items()').
> To test for membership, you _had_ to catch an exception - using VB's
> tragically clumsy exception model.
> Hours of fun. That leads us to this topic:
> --

An experienced C programmer can program C in any language, but that
doesn't mean it's a good idea to.

When you're using a language, you should use the style that the
language emphasizes. While you shouldn't use exceptions for control
flow in C++, Java, or C#, there's nothing wrong with using them as
such in Python.

More information about the Python-list mailing list