Is there a way to change the closure of a python function?
dieter
dieter at handshake.de
Wed Sep 28 03:19:51 EDT 2016
Peng Yu <pengyu.ut at gmail.com> writes:
> Hi, In many other functional language, one can change the closure of a
> function. Is it possible in python?
I do not think so: the corresponding attributes/types ("__closure__", "cell")
are explicitely designed to be read only.
However, I never missed closure changebility. Should I really need it
(in an extreme rare case), I would bind the corresponding variable
to an object which could be modified at will.
More information about the Python-list
mailing list