Νίκος writes: > And i don't mean like this: > > if not city: > city ="blabla" > if not host: > host="blablabla" > > > Can thes be witten without and if perhaps with the use of 'or' > operator in 1-line within the except clause?
try: ... except socket.gaierror as e: # watch out, a composition of bad advice (on demand) city, host = ( ('city' in locals() or "blabla"), ('host' in locals() or "blablabla") ) -- https://mail.python.org/mailman/listinfo/python-list