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

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.

主站蜘蛛池模板: 昌江| 隆化县| 万州区| 化州市| 通化市| 荆州市| 平顺县| 怀远县| 密山市| 托里县| 绍兴市| 聂拉木县| 霸州市| 长丰县| 普兰县| 平泉县| 滁州市| 中阳县| 浦城县| 高要市| 常德市| 沙坪坝区| 四会市| 全椒县| 漳州市| 通化县| 石狮市| 锡林浩特市| 涞水县| 林西县| 龙江县| 富阳市| 湟源县| 黄平县| 舞阳县| 福清市| 洪泽县| 沁水县| 彰化县| 汉源县| 靖西县|