UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

Lele Gaifax lele at metapensiero.it
Fri Jul 5 08:55:20 CEST 2013

Ferrous Cranus <nikos at superhost.gr> 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 "<stdin>", line 1, in <module>
    ZeroDivisionError: division by zero
    >>> a
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'a' is not defined
    >>> a = 0/1 or 100
    >>> a

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 at metapensiero.it  |                 -- Fortunato Depero, 1929.

More information about the Python-list mailing list