is_<whatever_you_are_testing_for> as method or property?

Chris Angelico rosuav at gmail.com
Fri Dec 12 06:26:42 EST 2014


On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot <mateusz at 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.

ChrisA



More information about the Python-list mailing list