O'Reilly logo
  • Atif Zafar thinks this is interesting:

As soon as your expressions get complicated, it’s time to consider splitting them into smaller pieces and moving logic into helper functions. What you gain in readability always outweighs what brevity may have afforded you. Don’t let Python’s pithy syntax for complex expressions get you into a mess like this.


Cover of Effective Python: 59 Specific Ways to Write Better Python


Split the code into smaller simple chunks