On Sat, Jul 2, 2016 at 5:32 AM, Ankush Thakur <ankush.thaku...@gmail.com> wrote: > On Friday, July 1, 2016 at 9:13:19 AM UTC+5:30, Lawrence D’Oliveiro wrote: >> >> > Shouldn't we be instead using self.celcius in, say, __init__() and then >> > everything will work fine? >> >> I guess it might. But this way, using descriptors, all the setup is done >> once at class definition, rather then every time in class instantiation. > > So you're saying the (sole) reason to instantiate descriptor classes at > class-level is performance?
Performance might be part of it (it also saves some checks when looking up attributes), but in my opinion a big reason for it is separation of responsibilities. Classes define object behavior; instances contain object state. For example, you can't define a method on an instance (though you can certainly store a function there and call it). -- https://mail.python.org/mailman/listinfo/python-list