Well I certainly Understand if-else that are return in single line like
return 0 if x==y else 1
Which translate to
if x==y:
return 0
else:
return 1
I am confused about those statements where if-else occurs multiple time in one line like
def _cmp(x, y):
return 0 if x == y else 1 if x > y else -1
How to resolve them to indented multiline if-else statements.
Aucun commentaire:
Enregistrer un commentaire