Python-Django-源码 (

    xiaoxiao2022-07-02  121

    Django 源码中

    django.conf.init.py 中

    class SettingsReference(str): """ String subclass which references a current settings value. It's treated as the value in memory but serializes to a settings.NAME attribute reference. """ def __new__(self, value, setting_name): return str.__new__(self, value) def __init__(self, value, setting_name): self.setting_name = setting_name

    __new__的第一个参数是 self,为什么不是cls?

    最新回复(0)