Chapter 16: Following Best Practices

In this chapter, we will learn some of the best practices from Python programming that we can follow and apply to metaprogramming too. The practices suggested in Python Enhancement Proposal 8 (PEP 8), the style guide for Python code, also apply to metaprogramming.

The concepts behind PEP 8 originated and are explained in detail in the documentation by Guido van Rossum, Barry Warsaw, and Nick Coghlan at This chapter will cover some of the important concepts from PEP 8 with examples using ABC Megamart of how they can be implemented in metaprogramming as well as general Python programming.

In this chapter, we will be looking at the following main topics:

  • Following PEP 8 standards ...

Get Metaprogramming with Python now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.