Why are functions atomic?
"Martin v. Löwis"
martin at v.loewis.de
Tue May 1 14:25:13 EDT 2007
> I know I could use a 'functor' defining __call__ and using member
> variables, but this is more complicated and quite a bit slower. (I
> also know that I can use new.function to create a new copy, but I
> would like to know the rational behind the decision to make functions
> atomic before I shoot myself in the foot;-)
Function objects were not copyable because they were immutable. For
an immutable object, a copy cannot reasonably be distinguished from
the original object. See copy.py, around line 105.
Regards,
Martin
More information about the Python-list
mailing list