第618页 | Learning Python | 阅读 ‧ 电子书库

同步阅读进度,多语言翻译,过滤屏幕蓝光,评论分享,更多完整功能,更好读书体验,试试 阅读 ‧ 电子书库

Test Your Knowledge: Quiz

 

 
When we fetch a Manager object from the shelve and print it, where does the display format logic come from?When we fetch a Person object from a shelve without importing its module, how does the object know that it has a giveRaise method that we can call?Why is it so important to move processing into methods, instead of hardcoding it outside the class?Why is it better to customize by subclassing rather than copying the original and modifying?Why is it better to call back to a superclass method to run default actions, instead of copying and modifying its code in a subclass?Why is it better to use tools like __dict__ that allow objects to be processed generically than to write more custom code for each type of class?In general terms, when might you choose to use object embedding and composition instead of inheritance?How might you modify the classes in this chapter to implement a personal contacts database in Python?

请支持我们,让我们可以支付服务器费用。
使用微信支付打赏


上一页 · 目录下一页


下载 · 书页 · 阅读 ‧ 电子书库