Handling 3 operands in an expression without raising an exception

Denis McMahon denismfmcmahon at gmail.com
Thu Sep 26 16:16:38 EDT 2013


On Thu, 26 Sep 2013 19:58:02 +0300, Νίκος wrote:

> except socket.gaierror as e:
> 	city = host = "UnKnown Origin"
> 
> But then what if in case of an error i needed different string set to be
> assigned on city and host respectively?

Oh FFS

Are you serious when you ask this?

Simply change:

except socket.gaierror as e:
    city = host = "UnKnown Origin"

To:

except socket.gaierror as e:
    city = "Unknown City"
    host = "Unknown Host"

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list