Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'subject:module': 0.04; 'one?': 0.05; 'exceptions': 0.09; 'scripts': 0.10; 'answer,': 0.16; 'shell': 0.19; 'wondering': 0.19; 'programming': 0.20; '(and': 0.22; 'expect': 0.26; "i'm": 0.26; 'developers': 0.28; 'raise': 0.29; 'error': 0.29; 'message-id:@gmail.com': 0.30; 'to:addr:python-list': 0.32; 'bit': 0.33; 'module': 0.33; 'received:192.168.1': 0.34; 'received:192': 0.34; 'certain': 0.34; 'header:User-Agent:1': 0.35; 'module.': 0.35; 'trigger': 0.35; 'considered': 0.36; 'received:192.168': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'errors': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'best': 0.60; 'show': 0.67; 'message?': 0.84; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84; 'subject:handle': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:x-enigmail-version:content-type:content-transfer-encoding; bh=GptAOOGCH3X+J6in8n9l/PeGFGzQsvftxs43bWDDZx0=; b=P9daroRoXaMHPQg83IE6BgorQB0htT6BRcdFaHe8kJias10W2h7FUOUM1Z8psw99fX Bgi/2R2BXUAqy0Dw677Z/v2QO7QO6dx0ibw0HGViwW7EB+uamHm+Xl+XSfGskkiMF6/g tQ6yQyy4MWS4A2IHQ7JJiI/bwmNOjP5iG9F1M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; b=EZrlM53VSwr45tAmG3ZGdxND1VZSzJMRbpLXDaCCkUykBSvK6202MI6c5bJwIHQCQn gzJnXlA+SdOzsWfUNMkRhfYo44sbrcrrkI3cdrE2uDFy9eE4MN+5tOgWaOhSbvqsvGQv UvfaxYJqkCHf6l+58jEQiJy2H9SrX7dpfOdqo= Date: Wed, 11 May 2011 12:29:50 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: python-list@python.org Subject: Proper way to handle errors in a module X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 8 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305134998 news.xs4all.nl 81475 [::ffff:82.94.164.166]:58517 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5134 I'm a bit new to programming outside of shell scripts (and I'm no expert there), so I was wondering what is considered the best way to handle errors when writing a module. Do I just let exceptions go and raise custom exceptions for errors that don't trigger a standard one? Have the function/method return nothing or a default value and show an error message? I'm sure there's not a clear-cut answer, but I was just wondering what most developers would expect a module to do in certain situations.