On Sat, Mar 12, 2016 at 4:59 PM, Veek. M <vek.m1...@gmail.com> wrote: > A property uses the @property decorator and has @foo.setter > @foo.deleter. > > A descriptor follows the descriptor protocol and implements the __get__ > __set__ __delete__ methods. > > But they both do essentially the same thing, allow us to do: > foo = 10 > del foo > x = foo > > So why do we have two ways of doing this?
The descriptor protocol is what powers the @property decorator. It's like asking why we have both lists and sequences; the sequence protocol is how you interact with lists. ChrisA -- https://mail.python.org/mailman/listinfo/python-list