摘要: 元类 【一】什么是元类 产生已知类的类就叫元类 def func(): # ... print(type(func)) # <class 'function'> data_dict={'name':'hope'} print(type(data_dict)) #<class 'dict'> 【二】产 阅读全文
posted @ 2024-01-08 21:07 -半城烟雨 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 魔法方法 __init__ :初始化类时触发 __del__ :删除类时触发 __new__ :构造类时触发 __str__ :str函数或者print函数触发 __repr__ :repr或者交互式解释器触发 __doc__ :打印类内的注释内容 __enter__ :打开文档触发 __exit_ 阅读全文
posted @ 2024-01-08 21:07 -半城烟雨 阅读(6) 评论(0) 推荐(0) 编辑