The Samurai Principle

Phlip phlip2005 at gmail.com
Wed Sep 8 00:20:27 CEST 2010


On Sep 7, 1:06 pm, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> 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:

http://www.google.com/search?q=don't+use+exceptions+for+normal+control+flow



More information about the Python-list mailing list