原项目是我看过的介绍Python Magic Method 最好的文章. 我很希望有更多的人来学习python, 了解python.
我将该文章翻译成了中文,放在了我的博客上
此外, 对于我在阅读英语原文过程中感到生涩难懂的部分, 或者作者没有提及的部分,我写了一些例子来说明解释.
由于有自己对于学习的考量,翻译过程中,我将一些章节的顺序进行了修改,将常见的魔术方法放在前面介绍.
希望对你的python学习会有帮助^^
Written by Rafe Kettler in the year 2011.
Licensed under Creative Commons CC--NC-BY-SA (see http://creativecommons.org/licenses/by-nc-sa/3.0/). Basically, noncommercial, requires attribution, must be reproduced with a similar license. 'Nuff said.
Can be seen at http://www.rafekettler.com/magicmethods.html in relatively up to date form.
Edit magicmethods.markdown
/magicmethods.tex
, then run make docs
. The build script requires the Python Markdown module, so you'll have to run pip install markdown
if you don't already have it. Happy hacking!