Why are functions atomic?

Michael michael.forbes at gmail.com
Tue May 1 14:40:21 EDT 2007


On May 1, 9:34 am, John Nagle <n... at animats.com> wrote:
> Michael wrote:
> > Why are functions atomic?  (I.e. they are not copied.)
>
>      Because Python has objects for when you need to associate
> state with a function.
>
>                                 John Nagle

Then why are functions mutable?

I can understand to some extent why functions are not picklable,
because the bytecode may not be the same across python implementations
(is that true?), but I do not understand why copying functions is a
problem.  The patch that allows copy to pass-through functions just
emulates pickle, but I can find no discussion or justification for not
allowing functions to be copied:

http://thread.gmane.org/gmane.comp.python.devel/76636

Michael.




More information about the Python-list mailing list