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.
- 1. Pythonic Thinking
- from Effective Python: 59 Specific Ways to Write Better Python
- Publisher: Addison-Wesley Professional
- Released: March 2015
Split the code into smaller simple chunks
Share this highlighthttp://www.safaribooksonline.com/a/effective-python-59/430044/