这里的property和在方法上加上@property有什么区别?

来源:7-4 如何创建可管理的对象属性

BskyRui

2016-12-01

比如

@property

    def price(self):

        return 22.22


    @price.setter

    def price(self, value):

        print('@price.setter')


    @price.deleter

    def price(self):

        print('@price.deleter')


写回答

1回答

程序员硕

2016-12-02

本质上一样的,俩种形式.

0
1
BskyRui
非常感谢!
2016-12-02
共1条回复

Python高效编程技巧实战

精选50个Python案例,源自实战,全面提升Python编程能力

2582 学习 · 360 问题

查看课程