摘要:
原理:利用元类型,重新定义类实例化一个新对象的方法(__call__)行为。让其只返回同一个实例。#-*- coding: UTF-8 -*-#-------------------------------------------------------------------------------# Name: ģ��shell# Purpose: Ӧ�ó����main��ں���## Author: ankier## Created: 26-10-2012# Copyright: (c) ankier 2012# Licence: <... 阅读全文
摘要:
metaclass,元类metaclass是这样定义的:In object-oriented programming,a metaclass is a class whose instances are classes.Just as an ordinary class defines the behavior of certain objects,a metaclass defines the behavior of certain classes and their instances.metaclass的实例化结果是类,而class实例化的结果是instance。metaclass是创建 阅读全文