On 12 December 2014 at 12:26, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot <mate...@loskot.net> wrote: >> I've got several cases which are not obvious to me. >> For instance, class Foo has a boolean attribute, read-write, >> which I see a couple of realisations for possible: >> > > 0) Attribute only. > > class Foo: > pass > > Foo().default = True > > Unless you need something more than this, go with this style. Much simpler.
Agreed, in general, but if the question was related to such simple case, I wouldn't bother asking it. I mentioned, setting the new value involves more changes to Foo() instance, so i's not possible to capture it with just an assignment. Hence, the discussion between property vs method. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net -- https://mail.python.org/mailman/listinfo/python-list