O'Reilly logo

Python Algorithms: Mastering Basic Algorithms in the Python Language, Second Edition by Magnus Lie Hetland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX A

image

Pedal to the Metal: Accelerating Python

Make it work, make it right, make it fast.

— Kent Beck

This appendix is a tiny peek at some of the options for tweaking the constant factors of your implementations. Although this kind of optimization in many cases won’t take the place of proper algorithm design—especially if your problems can grow large—making your program run ten times as fast can indeed be useful.

Before calling for external help, you should make sure you’re using Python’s built-in tools to their full potential. I’ve given you some pointers throughout the book, including the proper uses of list versus deque and how bisect ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required