Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'interpreter': 0.05; "subject:' ": 0.07; "'a'": 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:position': 0.09; 'utilizing': 0.09; 'python': 0.11; 'argument.': 0.16; 'emanuele': 0.16; 'nameerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:start': 0.16; 'exception': 0.16; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'define': 0.26; 'handling': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'host': 0.29; 'evaluation': 0.30; 'gives': 0.31; '"",': 0.31; 'division': 0.31; 'invoke': 0.31; 'writes:': 0.31; 'file': 0.32; '(most': 0.33; 'could': 0.34; 'no,': 0.35; 'false': 0.36; 'impression': 0.36; 'wrong': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; '2nd': 0.60; 'che': 0.60; 'simply': 0.61; 'first': 0.61; 'name': 0.63; '100': 0.79; 'quando': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lele Gaifax Subject: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Date: Fri, 05 Jul 2013 08:55:20 +0200 Organization: Nautilus Entertainments References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 151.62.83.144 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:BPiHRikKN0JP6zl1dGbupkhizW0= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373007329 news.xs4all.nl 16004 [2001:888:2000:d::a6]:44136 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49930 Ferrous Cranus writes: > host = gethostbyaddr(....) or "UnResolved" > > This will return the first argument that define the evaluation as > being true or untrue. > > if function returns false the the 2nd argument. > Nut if the function gives an exception will the condition return the > 2nd argument or will the program fail? > > I was udner the impression that i could avoid error handling inside > try/excepts by utilizing "or". No, you had the wrong impression. Why don't you simply invoke the Python interpreter and try things out with that?? >>> a = 1/0 or 100 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: division by zero >>> a Traceback (most recent call last): File "", line 1, in NameError: name 'a' is not defined >>> a = 0/1 or 100 >>> a 100 >>> ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929.