社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

python property语法

redcafe2012-weibo • 10 年前 • 2541 次点击  

在查看flask API的时候对property有点困惑

class SessionMixin(object):
    def _get_permanent(self):
        return self.get('_permanent', False)

    def _set_permanent(self, value):
        self['_permanent'] = bool(value)

    permanent = property(_get_permanent, _set_permanent)
    del _get_permanent, _set_permanent

代码里为permanent属性通过property设置了getter和setter方法,那最后一句

del _get_permanent, _set_permanent

又是什么意思,求指教。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/550
 
2541 次点击