Message295057
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
set_cell('something')
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:27 | terry.reedy | set | recipients:
+ terry.reedy, gvanrossum, rhettinger, ncoghlan, pitrou, benjamin.peterson, lisroach, Jim Fasarakis-Hilliard |
2017-06-02 22:00:27 | terry.reedy | set | messageid: <1496440827.1.0.403865012729.issue30486@psf.upfronthosting.co.za> |
2017-06-02 22:00:26 | terry.reedy | link | issue30486 messages |
2017-06-02 22:00:26 | terry.reedy | create | |
|