python-makefun
python-makefun copied to clipboard
Should we add an explicit `funcopy` function ?
def funcopy(f):
"""Creates an actual copy of a function, since python copy() does not"""
return partial(f)
Just curious: what does copy.deepcopy do that I'm missing that precludes it from being a "true" copy?
Thanks @makslevental !
See discussions here :
- https://stackoverflow.com/questions/6527633/how-can-i-make-a-deepcopy-of-a-function-in-python
- https://stackoverflow.com/questions/13503079/how-to-create-a-copy-of-a-python-function
I did not follow all of this so not sure this is still needed / relevant. This original issue was a way for me to remember the (odd but existing) practice of copying a function using partial, and remembering that maybe there was an actual need.
Would need some digging to confirm.