Hi DrPi,
I addressed some of this in Discourse: New, copy, clone or duplicate?
And I have added this copy() function to my Signal class (in my local MyHDL library) and in my experimental Array() and StructType() classes.
It exactly achieves what you want and I use it all the time.
My copy() function re-uses the initial value of the original object. I don’t readily see a use for the initial_output. But the copy() could be easily extended to take this initial_output argument.
However, I don’t know if it is a good idea to add extra arguments to the copy() call as this will divert it from the _copy() and _deepcopy_() hooks.
Regards,
Josy