On Sun, Dec 19, 2021 at 5:41 AM Serhiy Storchaka <storch...@gmail.com>
wrote:

So you can use a combination of @classmethod and @property.
>
> class Data:
>     @classmethod
>     @property
>     def imagesTotal(cls):
>         return 10


And this would be more useful anyway: if you want a class property, it may
well need access to other class attributes— and now you have that access:

-CHB





> There are some issues with help() and unittest.mock. They may not work
> as you expected.
>
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/JQKITGZCCE2LM6ZJJETW4FRIZR3B3463/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/S7YBPQ4FYO3736HDXHTN2LGTXXNS6UAP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to