On Wed, Aug 5, 2020 at 1:27 PM Ricky Teachey <ricky@teachey.org> wrote:
On Wed, Aug 5, 2020 at 11:41 AM Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
On Wed, 5 Aug 2020 at 15:53, Ricky Teachey <ricky@teachey.org> wrote:
from mypython import *
@const a = 5

 I'm probably dim but I have no idea what that is supposed to mean or do. Is this just calling const(a=5)...? what is the point of that?

I'm not advocating it, and I'm not the one that came up with it. But my impression is that it is intended to mean:

a = const('a', 5)

This doesn't seem completely pointless:

>>> class const():
...     def __init__(self, name, val):
...         self.name = name
...         self.val = val
...     def about(self):
...         print(self.name, '=', self.val)
...
>>> a = const('a', 5)
>>> a.val
5
>>> a.about()
a = 5

There might be a way to subclass, e.g. int, so that you don't need to use `a.val` to get the value.  It wasn't obvious to me how to do it in pure Python with 3 minutes thought.


--
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.