官术网_书友最值得收藏!

Summary

In this chapter, we learned how to write composable code. We saw examples of non-composable MEL style code, such as Maya's listing functions. We learned how to turn this legacy code into clean, composable functions, such as head, tail, first_or_default, and is_exact_type. We created a reusable library for converting a hierarchy of transforms into joints. We used that library for a configurable character creator module that can easily be called through a UI. Along the way, we learned about list comprehensions, contracts, selecting and filtering, closures, refactoring, docstrings, and improving PyMEL performance.

Writing composable code, and the topics in this chapter, are the foundation for a successful and enjoyable experience programming Python in general, and Python in Maya particularly. This is the way of the Pythonista.

Unfortunately, despite the composability of our functions, the care and craft of our projects, the documentation we provide, and no matter how Pythonic our code is, there will be problems. Mistakes will be made. Edge cases exploited. Bugs found. Dealing with these errors is the topic of the next chapter.

主站蜘蛛池模板: 墨脱县| 福鼎市| 五指山市| 固原市| 中江县| 获嘉县| 克东县| 安国市| 疏附县| 瑞丽市| 双峰县| 平谷区| 若尔盖县| 南和县| 绿春县| 泾阳县| 营口市| 惠水县| 邵东县| 汉沽区| 多伦县| 宁安市| 神农架林区| 五台县| 大田县| 潼南县| 正宁县| 策勒县| 历史| 屯留县| 德令哈市| 伊宁市| 武隆县| 新密市| 兰西县| 房山区| 和政县| 得荣县| 泰宁县| 中牟县| 元阳县|