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

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.

主站蜘蛛池模板: 南安市| 汝州市| 博湖县| 嘉义县| 陇西县| 牟定县| 永新县| 富民县| 定远县| 和静县| 固镇县| 贺兰县| 涟水县| 霍山县| 高雄县| 姜堰市| 大埔县| 连南| 永城市| 沾化县| 长白| 曲松县| 义马市| 海晏县| 云龙县| 紫金县| 鹤壁市| 朝阳县| 新巴尔虎左旗| 将乐县| 正蓝旗| 禄劝| 务川| 三门峡市| 湘潭市| 鹤壁市| 同仁县| 托克逊县| 大兴区| 喜德县| 五常市|