alias.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:pyomo 作者: Pyomo 项目源码 文件源码
def __delattr__(self, name):
        # avoid infinite recursion
        if name in Alias.__slots__:
            raise TypeError("'dictproxy' object does not support item deletion")

        if name in Alias._component_slots:
            del super(Alias, self).__dict__[name]

        if self.aliased_object is None:
            raise weakref.ReferenceError("Proxy is not longer valid")
        return delattr(self.aliased_object, name)

    #
    # In addition to overloading __getattr__, the following magic
    # methods need to be redirected as Python does not access them
    # through __getitem__. If the aliased object does not implement
    # them an exception will be thrown
    #

    # E.g., IndexedComponent
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号