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
- What---Python演算法Python演算法
- SCSS @mixinCSS
- Vue Mixin混入Vue
- What is Babel?Babel
- what is life?
- What is WebpackWeb
- What is wrong?
- What is maven?Maven
- Numerical Results of RhDYas CG method and RhLHas CG method
- SCSS @mixin傳參CSS
- Python-unsupported operand type(s) for %: 'builtin_function_or_method' and 'int'PythonUIFunction
- Kernel Method
- Swizzling Method
- Greedy Method
- What is an SQL relation?SQL
- What is rate limiting?MIT
- What is a service mesh?
- WHAT IS PPM Encoder ?
- [譯]Flutter - Dart的MixinFlutterDart
- Vue中mixin的理解Vue
- 理解 Dart mixin 機制Dart
- Two Pointer Method
- python報錯:TypeError: slice indices must be integers or None or have an __index__ methodPythonErrorNoneIndex
- What does -> do in clojure?
- CISO之What & How
- What are the benefits of using an proxy?
- [Information Security] What is WEPORM
- What is dbo in SQL Server?SQLServer
- What is the "WF - Contention'' Enqueue ?ENQ
- SCSS @mixin和class 區別CSS
- 【譯】Dart | 什麼是MixinDart
- sass的mixin,extend,placeholder,functionFunction
- CSS程式碼段-scss mixinCSS
- Dart 基礎之Mixin(混入)Dart
- 學習Sass @mixin 與 @include
- IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokensExceptionHTTP
- [vue] computed 和 methodVue