On Wed, Aug 5, 2020 at 2:25 PM Jonathan Fine <jfine2...@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.
_______________________________________________ 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/JV7SYYTRYMODU4KKKFLXEI473SHK6RMA/ Code of Conduct: http://python.org/psf/codeofconduct/