2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
# 如果你需要创建大量的实例,那么你可以在类的定义中增加__slots__属性来让类不创建__dict__字典
class Date:
__slots__ = ('year', 'month', 'day')
def __init__(self, year, month, day):
self.year = year
self.month = month
self.day = day
# 这会让类围绕着__slots__属性进行构建,副作用就是这个类被写死了,我们无法为它的实例添加新的属性
# 使用了__slots__的类会失去多重继承的用法,请确保只在被当作数据结构的类中使用该方法