Handling 3 operands in an expression without raising an exception

Antoon Pardon antoon.pardon at rece.vub.ac.be
Thu Sep 26 07:47:23 EDT 2013


Op 26-09-13 13:25, Νίκος schreef:
>>
> Okey then please tell me, what do you see wrong in it:
> 
> socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or
> os.environ.get('REMOTE_ADDR') or  "Άγνωστη Προέλευση" )[0]
> 
> the [0] at then end in case the statemnt default to the string?
> please tell me in details what might go wrong with it so i cna
> understand it.

Startup python and try to figure it out yourself. Show us you can
really learn something.

-- 
Antoon Pardon




More information about the Python-list mailing list