what is the Mixin method in Python?
Based on the results I searched from google, it has something to do with the multi inherits.
so based on the multi inherit of Python, we can implement a class called Mixin.
the defination of Mixin: Mixin classes contain only a specific set of functionalities that we want to be able to mix in with other classes to compose a new class.
but it’s so hard to understand what these words means.
用中文解釋一下 就是:
Mixin程式設計是一種開發模式,是一種將多個類中的功能單元的進行組合的利用的方式,這聽起來就像是有類的繼承機制就可以實現,然而這與傳統的類繼承有所不同。通常mixin並不作為任何類的基類,也不關心與什麼類一起使用,而是在執行時動態的同其他零散的類一起組合使用。
使用mixin機制有如下好處:可以在不修改任何原始碼的情況下,對已有類進行擴充套件;可以保證元件的劃分;可以根據需要,使用已有的功能進行組合,來實現“新”類;很好的避免了類繼承的侷限性,因為新的業務需要可能就需要建立新的子類。
reference:
https://blog.csdn.net/u012814856/article/details/81355935
相關文章
- Python mixin模式Python模式
- Python Mixin解釋Python
- What else is there in Python?Python
- Python中的methodPython
- Python Mixin混入的使用方法Python
- What---Python演算法Python演算法
- Python 魔術方法 - Magic MethodPython
- 草根學Python(十)Python 的 Magic MethodPython
- SCSS @mixinCSS
- Python: 函式與方法的區別 以及 Bound Method 和 Unbound MethodPython函式
- GoldenGate - What is supported and what is not ....Go
- Vue Mixin混入Vue
- What is it?
- SCSS @mixin傳參CSS
- What is WebpackWeb
- What is Babel?Babel
- What is MySQL?MySql
- What is Gravity
- what is life?
- What is wrong?
- [譯]Flutter - Dart的MixinFlutterDart
- 理解 Dart mixin 機制Dart
- Vue中mixin的理解Vue
- react 學習--使用MixinReact
- CSS常用Mixin封裝CSS封裝
- React Mixin 的前世今生React
- Python-unsupported operand type(s) for %: 'builtin_function_or_method' and 'int'PythonUIFunction
- What is an SQL relation?SQL
- What time is it on Mars?
- what the fuck java is?Java
- What is tradebit?
- What is functor in Haskell ?Haskell
- What is Scalability?
- what is ORACLE ACEOracle
- what is sql?(轉)SQL
- In Oracle,What Is a Service?Oracle
- What happened ?APP
- What is INITRANS and MAXTRANS