{"id":41967,"date":"2021-07-23T21:41:36","date_gmt":"2021-07-23T21:41:36","guid":{"rendered":"https:\/\/www.oracletutoring.ca\/blog\/?p=41967"},"modified":"2021-07-23T21:41:37","modified_gmt":"2021-07-23T21:41:37","slug":"python-shallow-copy-vs-deep-copy","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/python-shallow-copy-vs-deep-copy\/","title":{"rendered":"Python: shallow copy vs deep copy"},"content":{"rendered":"\n<h2>Self-tutoring about Python: shallow copy vs deep copy.<\/h2>\n<p>A deep copy is a new object: if you change its source, the deep copy won&#8217;t change. However, if you change the source, a shallow copy will change with it, if the change is made to a mutable object. Therefore, reassigning a string won&#8217;t alter its shallow copy: Python strings are immutable.<\/p>\n<p><a href=\"https:\/\/docs.python.org\/3\/library\/copy.html\">docs.python.org<\/a><\/p>\n<p><a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html\">docs.python.org<\/a><\/p>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.\n","protected":false},"excerpt":{"rendered":"<p>Self-tutoring about Python: shallow copy vs deep copy. A deep copy is a new object: if you change its source, the deep copy won&#8217;t change. However, if you change the source, a shallow copy will change with it, if the &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/python-shallow-copy-vs-deep-copy\/\"> <span class=\"screen-reader-text\">Python: shallow copy vs deep copy<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1856],"tags":[],"class_list":["post-41967","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=41967"}],"version-history":[{"count":3,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41967\/revisions"}],"predecessor-version":[{"id":41970,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41967\/revisions\/41970"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=41967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=41967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=41967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}