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

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.

主站蜘蛛池模板: 衡东县| 涞源县| 封丘县| 玛纳斯县| 高安市| 辽宁省| 永济市| 天津市| 桂平市| 民县| 灌云县| 博野县| 武宣县| 新巴尔虎左旗| 五河县| 买车| 宝山区| 兴仁县| 信宜市| 慈溪市| 扶绥县| 察雅县| 滨海县| 永川市| 萝北县| 盐池县| 和顺县| 焦作市| 平武县| 德昌县| 金塔县| 都兰县| 高清| 六枝特区| 马边| 南投县| 宁城县| 高邑县| 洛扎县| 洛阳市| 庆阳市|