On Wed, Aug 5, 2020 at 2:25 PM Jonathan Fine <jfine2358@gmail.com> wrote:
Real world examples where it would be useful are generally worth much more than invented examples.

I agree that @const is not really a useful "value decorator." I was just picking up the example that occurred up-thread.

Here's something I think could be more useful (again, I'm +0 at best myself).

>>> @unit("meter") a = 3  # a = unit("meter")("a", 3)
>>> @unit("foot") b = 4   # b = unit("foot")("b", 4)
>>> a, a.name, a.unit
(3, "a", "meter")

Implementation left to reader, but basically it's exactly Ricky's __new__(), just wrapped in a class factory function to parameterize the unit.



--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.