Author terry.reedy
Recipients Jim Fasarakis-Hilliard, benjamin.peterson, gvanrossum, lisroach, ncoghlan, pitrou, rhettinger, terry.reedy
Date 2017-06-02.22:00:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A possible counter-indication would be if setting a cell could cause a crash, as opposed to a mysterious exception.  Since 3.x already allows writing any object to a cell from python code,
def outer():
    cell = None
    def inner(ob):
        nonlocal cell
        cell = ob  # rebinds <hidden-cell>.cell_contents
    return inner

set_cell = outer()
print(set_cell.__closure__[0].cell_contents)  # None
print(set_cell.__closure__[0].cell_contents)  # 'something'

making "cell.cell_contents = 'something'" legal should not enable more crashes.

I think that "function.__closure__[i].cell_contents = object" is perhaps not a good idea for production code, but I think it falls within the realm of 'consenting adults code' for the other uses suggested above.  How should it be documented?
Date User Action Args
2017-06-02 22:00:27terry.reedysetrecipients: + terry.reedy, gvanrossum, rhettinger, ncoghlan, pitrou, benjamin.peterson, lisroach, Jim Fasarakis-Hilliard
2017-06-02 22:00:27terry.reedysetmessageid: <>
2017-06-02 22:00:26terry.reedylinkissue30486 messages
2017-06-02 22:00:26terry.reedycreate