- Expert Python Programming(Second Edition)
- Micha? Jaworski Tarek Ziadé
- 220字
- 2021-07-16 10:58:07
Chapter 3. Syntax Best Practices – above the Class Level
We will now focus on syntax best practices for classes. It is not intended to cover design patterns here, as they will be discussed in Chapter 14, Useful Design Patterns. This chapter gives an overview of the advanced Python syntax to manipulate and enhance the class code.
Object model evolved greatly during history of Python 2. For a long time we lived in a world where two implementations of the object-oriented programming paradigm coexisted in the same language. These two models were simply referred to as old-style and new-style classes. Python 3 ended this dichotomy and only model known as new-style classes is available to the developers. Anyway, it is still important to know how both of them worked in Python 2 because it will help you in porting old code and writing backwards compatible applications. Knowing how the object model changed will also help you in understanding why it is designed that way right now. This is the reason why the following chapter will have a relatively large number of notes about old Python 2 features despite this book targets the latest Python 3 releases.
The following topics will be discussed in this chapter:
- Subclassing built-in types
- Accessing methods from super classes
- Using properties and slots
- Metaprogramming
- 流量的秘密:Google Analytics網(wǎng)站分析與優(yōu)化技巧(第2版)
- Java范例大全
- Python語(yǔ)言程序設(shè)計(jì)
- Architecting the Industrial Internet
- R語(yǔ)言游戲數(shù)據(jù)分析與挖掘
- TypeScript實(shí)戰(zhàn)指南
- Android 應(yīng)用案例開發(fā)大全(第3版)
- 名師講壇:Spring實(shí)戰(zhàn)開發(fā)(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- Java網(wǎng)絡(luò)編程核心技術(shù)詳解(視頻微課版)
- C和C++游戲趣味編程
- Android嵌入式系統(tǒng)程序開發(fā):基于Cortex-A8(第2版)
- Web編程基礎(chǔ):HTML5、CSS3、JavaScript(第2版)
- Spring Boot從入門到實(shí)戰(zhàn)
- C語(yǔ)言王者歸來(lái)
- Python繪圖指南:分形與數(shù)據(jù)可視化(全彩)