If you want RuntimeError raise if an attempt was made to modify, use freeze() . If you want the caller to not be able to modify your data, then clone() is a good choice.
Keep in mind that freeze () may not work as you expect .
Personally, I never needed freeze() , but clone() often useful.
source share