On Tue, Sep 7, 2010 at 6:20 PM, Phlip <phlip2...@gmail.com> wrote: > On Sep 7, 1:06 pm, Bruno Desthuilliers > <bdesth.quelquech...@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 > --
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. -- http://mail.python.org/mailman/listinfo/python-list