# object-references

Published articles for object-references.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## How Shallow and Deep Copies Work in Python

DevFeed: [How Shallow and Deep Copies Work in Python](<https://devfeed.tech/articles/how-shallow-and-deep-copies-work-in-python-85735.md>)

Original publisher: [Read original article](<https://hackernoon.com/how-shallow-and-deep-copies-work-in-python?source=rss>)

Author: Sohel Alam

Published: 2026-10-12T16:55:52Z

Content type: tutorial

Language: en

Sources: [HackerNoon](<https://devfeed.tech/sources/hackernoon.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [code](<https://devfeed.tech/tags/code.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [deep-copy](<https://devfeed.tech/tags/deep-copy.md>), [mutable-default-arguments](<https://devfeed.tech/tags/mutable-default-arguments.md>), [object-references](<https://devfeed.tech/tags/object-references.md>), [python](<https://devfeed.tech/tags/python.md>), [python-debugging](<https://devfeed.tech/tags/python-debugging.md>), [python-dictionaries](<https://devfeed.tech/tags/python-dictionaries.md>), [python-mutability](<https://devfeed.tech/tags/python-mutability.md>), [python-programming](<https://devfeed.tech/tags/python-programming.md>), [shallow-copy](<https://devfeed.tech/tags/shallow-copy.md>)

### AI overview

This tutorial explains how Python dictionary copies behave when they contain mutable nested objects. A shallow copy duplicates the outer dictionary while sharing references to nested values, so in-place changes can affect both dictionaries. It shows when copy.deepcopy() is useful, why it can cost more memory and time, and how mutable default arguments can cause a similar sharing problem.

### Source excerpt

I copied a Python dictionary, but the original still changed. Here's how shallow copies, shared references, and deep copies actually work.

## Friday Q&A 2017-08-11: Swift.Unmanaged

DevFeed: [Friday Q&A 2017-08-11: Swift.Unmanaged](<https://devfeed.tech/articles/friday-q-a-2017-08-11-swift-unmanaged-30620.md>)

Original publisher: [Read original article](<http://www.mikeash.com/pyblog/friday-qa-2017-08-11-swiftunmanaged.html>)

Author: Mike Ash

Published: 2017-08-11T13:14:00Z

Content type: article

Language: en

Sources: [Mike Ash](<https://devfeed.tech/sources/mike-ash.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [atomic reference counting](<https://devfeed.tech/topics/atomic-reference-counting.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apis](<https://devfeed.tech/tags/apis.md>), [arc](<https://devfeed.tech/tags/arc.md>), [arc-memory-management](<https://devfeed.tech/tags/arc-memory-management.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [bridging](<https://devfeed.tech/tags/bridging.md>), [c](<https://devfeed.tech/tags/c.md>), [callback](<https://devfeed.tech/tags/callback.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [context](<https://devfeed.tech/tags/context.md>), [dns](<https://devfeed.tech/tags/dns.md>), [generic](<https://devfeed.tech/tags/generic.md>), [object](<https://devfeed.tech/tags/object.md>), [object-references](<https://devfeed.tech/tags/object-references.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [struct](<https://devfeed.tech/tags/struct.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

Swift's `Unmanaged` bridges object references and raw `void *` pointers while leaving ARC ownership decisions to the programmer. For Swift-to-C transfer, `passRetained` gives C an owned reference that must later be balanced; `passUnretained` adds no ownership and is safe only when the object remains alive or C takes ownership. Convert the wrapper with `toOpaque`. On return to Swift, use `fromOpaque` with the expected type, then `takeRetainedValue` to balance an owned reference or `takeUnretainedValue` without changing ownership. For callbacks, the article recommends unretained passing for synchronous calls, retained passing and release in a one-shot callback, and retaining across multi-shot callbacks until a separate destruction callback releases it. It cautions against `unsafeBitCast` for pointer conversion and notes that incorrect ownership can cause leaks, premature deallocation, or crashes.

### Source excerpt

In order to work with C APIs, we sometimes need to convert Swift object references to and from raw pointers. Swift's Unmanaged struct is the standard API for handling this. Today, I'd like to talk about what it does and how to use it. (Read More)