lundi 1 septembre 2014

Python code optimization - ternary operator


Vote count:

0




I have written following line of code but it is considered as an invalid syntax.



nextprevindicator=request.args[0] if len(request.args) else return 'bad request'


I want this to be written in one line so that code looks cleaner. Please suggest.



asked 45 secs ago







Python code optimization - ternary operator

Aucun commentaire:

Enregistrer un commentaire