Chapter 2. Writing Composable Code
In this chapter, we'll explore the concept of composable code. We start by defining the term. We then examine composable and non-composable examples to better understand what composability is, and improve code by refactoring. We will learn about important techniques to maximize composability, such as predicates, list comprehensions, contracts, closures, and docstrings. We put these techniques to work by building a library to convert a hierarchy of transforms into joints. After that, we compose this library into a configurable higher-level tool for creating characters. Finally, we will look at some issues and solutions surrounding PyMEL, composability, and performance.
Defining composability
The idea of composability ...
Get Practical Maya Programming with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.