# Weak Reference

say it: **“WEEK REF-er-ens”** **/ˈwik ˈrɛfərəns/**

Points to an object without keeping it alive.

## What is a **weak reference**?

A **weak reference** points to an object without keeping it alive. Once nothing else uses the object it is freed, and the weak reference gives back `None`. It's useful for caches.

```python
import weakref

class Photo:
    pass

photo = Photo()
ref = weakref.ref(photo)
print(ref() is photo)  # True
del photo
print(ref())           # None: the photo is gone
```

Level: Master · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=5)

Updated: November 17, 2026

## In other subjects

- [Weak Reference in JavaScript](https://www.ask-codey.com/glossary/weak-reference-javascript)

Source: https://www.ask-codey.com/glossary/weak-reference
