On Thu, Aug 06, 2020 at 04:03:39PM -0000, [email protected] wrote:
> No it is not possible to have something like this:
> ```python
> def function(cls):
> # Where is cls is Neuron class object
> pass
>
> class Neuron:
> activation = function(Neuron)
> ```
Correct. And it isn't possible with decorator syntax either:
py> def decorator(cls):
... print(cls)
... def inner(func):
... return func
... return inner
...
...
py> class Neuron:
... @decorator(Neuron)
... def method(self):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in Neuron
NameError: name 'Neuron' is not defined
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RRIABYLKDBBG7GBYYS5OL6M2WIIPRORM/
Code of Conduct: http://python.org/psf/codeofconduct/