[Python-ideas] make __closure__ writable

Mike Graham mikegraham at gmail.com
Tue Mar 20 15:40:24 CET 2012


On Fri, Mar 16, 2012 at 1:57 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> Can we make the __closure__ attribute writeable?  Since __code__ already is,
> and it is possible to tackle with the opcodes, having no way of rewriting
> __closure__ (except creating a completely new function) is annoying.
>
> I don't think it will somehow harm python, as those who want to break it can
> do it already in multiple ways, easier than playing with __closure__.
>
> -
> Yury

+1000, this would make code like
https://github.com/magcius/toenail/blob/master/ailment.py#L20 much
cleaner and more readable.

Mike



More information about the Python-ideas mailing list