Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For information of readers, Python does have a ternary operator. I don't know or care whether it is considered Pythonic, since it is basic Python syntax and seems quite readable to me, e.g.

x = (2 if y > 3 else 4)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: