Level 9 : What is the difference between a shallow copy and a deep copy in Python?

Author: IndraD | Tags: copy | 1859+ Python FAQs | Share
int | feature | thread | filtering-and-indexing | string | joining-and-merging-dataframes | id-function | handling-missing-values-(fillna,-dropna) | generators-in-python | identity-operators-(is,-is-not) | higher-order-function | identity-operator | regular-expression | split | sorting | keyword | string-formatting | expand-tab | list-indexing | advanced-file-operations | expression | introduction-to-multiprocessing | async | string-concatenation | intering | recursion | identity-operator | arbitrary-arguments-(*args,-**kwargs) | regex | class | list-join | __init_subclass__ | attribute | strings | inheritance | benefit | iterator | init | stack | threading | set | scientific-notation | classes | type-conversion-and-casting | with-statement | integer | encapsulation | why-use-multiprocessing-over-threading?-(gil) | asyncio-module | filter-function | built-in-function | using-lists-as-stacks | comprehension | import-method | unit-testing | anchors-(^,-$) | oop | method-overloading | enumerate() | mathematical-function | application | head-and-tail | file-handling | generators | type-conversion | logical-operation | assignment-operators | default-mutable-argument | implementation | boolean | __future__ | lambda-functions | raise | mathematics | operator-overloading | introduction-to-threads | interpreter | identifier | built-in-modules | round | global | max-min | polymorphism | indentation | raise-statement | aggregating-data-with-functools.reduce() | dictionary-comprehensions | dictionary | control-flow | functional-programming | mutable | oops | __all__-attribute | managing-directories-with-os-and-shutil | indexing:-loc-vs-iloc | file_handling | global-variable | key-value-pairs | dataframe-and-series-objects | filter | built-in | frozenset | virtual-environment | loop-control-statements | touples | error-handling | heap-memory | data-types | debugging | tuple | list-mutation | string-slicing | class-and-object | tuples | asyncio | conditional-statement | reading-and-writing-large-files-efficiently | class-and-inheritance | booleans | namedtuple | string-method | objects | command-line-parsing | python_version | iterators | input-function | random-function | assert | binary-operation | encoding | precedence | comment | error | arithmetic-operation | counter | immutable-data-type | lambda | numeric | goto-function | opening-files-(open()) | integers | pickling--unpickling | access-modifier | decimal | difference-between-threads-and-processes | append | matplotlib | logical-operators | data-structure | tuple-unpacking | library | operator | inherit | writing:-write(),-writelines() | list,-set,-and-dictionary-comprehensions | quantifiers-(*,-+,-?,-{}) | directory-operations | basic | data-type-conversions | docstring | assignment-operator | string-method | object-attribute | single-inheritance | exception-handling | logical-operator | function-argument | list-slicing | mapping-function | center | round-function | python-module | pseudocode | comparison | sorted | working-with-file-paths | choice | sorting-and-ranking | package-management | destructor | collection | using-join()-and-is_alive()-methods | binary | memory | precedence-and-associativity | multiple-except-blocks | immutability | working-with-dates-and-times | loop | nested-loop | bitwise-operator | rollback | dicts | introduction-to-python | functions | arithmetic-expression | postfix | floating-point-precision | matrix-list-comprehension | boolean-masking | data-structures | syntax-error | bitwise | regular-expressions | input | input-function | installation | overriding-methods | functional-programming | list | collections | control-statement | parsing-with-strptime | version-check | list-methods-and-slicing | constructor | class-and-instance-variable | boolean-and-non-boolean | data-type | python-repl | complex-number | array | sets | logical-operator | namespace | bitwise-operator | working-with-temporary-files-using-tempfile | data_structure | indexing | test-discovery | virtual-environment | call | class-decorators | generator | thread-synchronization | literal-characters-and-special-characters | python-syntax-and-structure | while-loop | while-loops | operations | global-variable | swapping | membership-operators-(in,-not-in) | tuple-methods | operator-and | design-principle | syntax | pass | default-arguments | deep-copy | join | list-comprehension | exception-handling | version | parameter | min-max-function | range | defining-functions | context-manager | floats | multiple-inheritance | fabs-function | invalid-list | function-and-scope | zfill-function | lambda-function | decorator | control-flow | update | method | pandas | time-series-with-pandas | loops | formal-and-actual-parameter | using-else-and-finally | shallow-copy | type_conversion | escape-operator | data-structures-in-python | datatype | math | gil | conditional-statements | typeerror | def | python-operators | python-history | sum-function | list-comprehensions | using-yield-in-functions | creating-custom-modules | iterable | dictionary-methods | exponentiation | data-type | multiprocessing | matrix | zip | counter-function | working-with-binary-files-(rb,-wb) | lambdas | conversion | else-statement | while-and-for-loop | data-structure | string-slicing | compute | copy | numpy | slice | datetime | exception | lists | creating-and-starting-threads | string-manipulation | string-formatting | format | sum() | reading:-read(),-readline(),-readlines() | conditional-statement | statement | print-statement | global-keyword | dictionaries | datetime.date,-datetime.time,-datetime.datetime | factorial-function | overflow | error-handling | else | string-iteration | condition | function | walking-through-directories-using-os.walk() | descriptors | file | reading-and-writing-files | for | file-handling | built-in-function | complex | syntax-error | type-conversion | static-method | map-function | memory-management | sys-module | python | set-operation | multiple-inheritance | variable | min-function | list-method | zip-function | using-os-and-pathlib-modules | match | list-operation | string-methods | recurssion | thread-safe-data-structures-(queue.queue) | list-comprehension | staticmethod | sys | python-django | math-copysign | mysql | turtle | slicing | multithreading | operator-or | return-statement | software-design | syntaxerror | magic-method | print | methods | using-map()-for-transformations | using-the-threading-module | operators | module | odd-number | loop-control | using-assertions-(assertequal,-assertraises) | list-vs-tuple | name-mangling | operand | yield | random | while-else-loop | pep | formatting-with-strftime ...