Ivan Pozdeev via Python-ideas wrote:
I needed to hold an external function
reference in an object instance (if I assigned it to an attribute, it
was converted into an instance method).
No, that only happens to functions stored in *class* attributes,
not instance attributes.
>>> class A:
... pass
...
>>> a = A()
>>>
>>> def f():
... print("I'm just a function")
...
>>> a.x = f
>>> a.x()
I'm just a function
--
Greg
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/