# Ideas

**URL:** https://discuss.python.org/c/ideas/6.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [About the Ideas category](https://discuss.python.org/t/about-the-ideas-category/20)

<div class="topic-metadata">

**Author:** [@ambv](https://discuss.python.org/u/ambv)\
**Replies:** 5\
**Last updated:** [October 31, 2024, 2:31pm UTC](https://discuss.python.org/t/about-the-ideas-category/20 "2024-10-31T14:31:09Z")

</div>

Would you like to change something in Python? This might be your feedback forum. Before you post, please read Changing Python to understand how to proceed and what to expect.

---

## [Syntactic sugar for union cases in match statements](https://discuss.python.org/t/syntactic-sugar-for-union-cases-in-match-statements/49274)

<div class="topic-metadata">

**Author:** [@tmk](https://discuss.python.org/u/tmk)\
**Replies:** 36\
**Last updated:** [September 28, 2026, 8:59pm UTC](https://discuss.python.org/t/syntactic-sugar-for-union-cases-in-match-statements/49274 "2026-09-28T20:59:53Z")

</div>

Given these definitions: from typing import NamedTuple, TypeAlias class A(NamedTuple): x: int y: str class B(NamedTuple): x: int y: str it would be nice if I could write the following: AB: TypeAlias …

---

## [Class-like syntax for union type aliases and natural docstrings](https://discuss.python.org/t/class-like-syntax-for-union-type-aliases-and-natural-docstrings/109103)

<div class="topic-metadata">

**Author:** [@mjmikulski](https://discuss.python.org/u/mjmikulski)\
**Replies:** 13\
**Last updated:** [September 28, 2026, 8:54pm UTC](https://discuss.python.org/t/class-like-syntax-for-union-type-aliases-and-natural-docstrings/109103 "2026-09-28T20:54:24Z")

</div>

In many type aliases, a union is the outermost operation. The recent PEP 846 (docstrings for type aliases) reminded me of an old idea of mine. That PEP proposes to attach a string statement to the preceding type stateme…

---

## [\`fnmatch.translate\` and anchoring](https://discuss.python.org/t/fnmatch-translate-and-anchoring/109239)

<div class="topic-metadata">

**Author:** [@pekkaklarck](https://discuss.python.org/u/pekkaklarck)\
**Replies:** 3\
**Last updated:** [September 28, 2026, 1:49pm UTC](https://discuss.python.org/t/fnmatch-translate-and-anchoring/109239 "2026-09-28T13:49:58Z")

</div>

fnmatch.translate can be used for converting glob patterns to regular expressions. It’s especially convenient if you want your tool to support pattern matching, but don’t want to confuse users with regular expressions. A…

---

## [Null Literal Unpacking](https://discuss.python.org/t/null-literal-unpacking/109195)

<div class="topic-metadata">

**Author:** [@gesslerpd](https://discuss.python.org/u/gesslerpd)\
**Replies:** 22\
**Last updated:** [September 28, 2026, 1:34am UTC](https://discuss.python.org/t/null-literal-unpacking/109195 "2026-09-28T01:34:17Z")

</div>

Prior discussion thread: PEP 802: Display Syntax for the Empty Set - #166 by gesslerpd This is a request for PEP sponsors and general continuation of this specific topic. Preamble PEP: TBD Title: Null Literal Unpacking…

---

## [Allow pycache\_prefix in pyvenv.cfg](https://discuss.python.org/t/allow-pycache-prefix-in-pyvenv-cfg/109249)

<div class="topic-metadata">

**Author:** [@rtasarz](https://discuss.python.org/u/rtasarz)\
**Replies:** 0\
**Last updated:** [September 26, 2026, 1:57pm UTC](https://discuss.python.org/t/allow-pycache-prefix-in-pyvenv-cfg/109249 "2026-09-26T13:57:15Z")

</div>

Currently I use venv and PYTHONPYCACHEPREFIX in most of my projects to keep caches out of source directories. The downside is that I have to track every way Python, tools, or venv-installed commands are invoked. Small mi…

---

## [Namespace blocks](https://discuss.python.org/t/namespace-blocks/108875)

<div class="topic-metadata">

**Author:** [@BenjyWiener](https://discuss.python.org/u/BenjyWiener)\
**Replies:** 39\
**Last updated:** [September 25, 2026, 1:59am UTC](https://discuss.python.org/t/namespace-blocks/108875 "2026-09-25T01:59:32Z")

</div>

I started playing with the idea of namespaces in Python due to the recent discussions about public/private. It’s often useful to group related items under a name, but creating a submodule isn’t always desirable. Python…

---

## [Improving the Turtle library](https://discuss.python.org/t/improving-the-turtle-library/61840)

<div class="topic-metadata">

**Author:** [@yngvem](https://discuss.python.org/u/yngvem)\
**Replies:** 24\
**Last updated:** [September 25, 2026, 1:13am UTC](https://discuss.python.org/t/improving-the-turtle-library/61840 "2026-09-25T01:13:58Z")

</div>

The Idea I’m a big fan of the turtle module (to the point where MarieRoald and I created a library to make embroidery patterns with turtle commands: https://turtlethread.com/), and I have used turtle.py several times in …

---

## [Abstract Base Class Safety Enhancements](https://discuss.python.org/t/abstract-base-class-safety-enhancements/109192)

<div class="topic-metadata">

**Author:** [@ralian](https://discuss.python.org/u/ralian)\
**Replies:** 8\
**Last updated:** [September 24, 2026, 4:57pm UTC](https://discuss.python.org/t/abstract-base-class-safety-enhancements/109192 "2026-09-24T16:57:18Z")

</div>

Hello, first time posting so let me know if I could do anything differently. I recently was messing around with a custom metaclass which does registration-time validation of ABC implementations (ensuring that an impleme…

---

## [Support File Descriptors in os.readlink()](https://discuss.python.org/t/support-file-descriptors-in-os-readlink/109101)

<div class="topic-metadata">

**Author:** [@OOTS](https://discuss.python.org/u/OOTS)\
**Replies:** 6\
**Last updated:** [September 24, 2026, 12:10pm UTC](https://discuss.python.org/t/support-file-descriptors-in-os-readlink/109101 "2026-09-24T12:10:16Z")

</div>

Hello! I’d like to propose adding support for file descriptors to os.readlink(). Currently, in os.readlink() can be called with strings, bytes, and (in general) PathLike objects (see the docs). It reads a symlink and re…

---

## [Alternative type-first annotation syntax: type: name = value](https://discuss.python.org/t/alternative-type-first-annotation-syntax-type-name-value/109156)

<div class="topic-metadata">

**Author:** [@AlensJames](https://discuss.python.org/u/AlensJames)\
**Replies:** 10\
**Last updated:** [September 23, 2026, 5:28pm UTC](https://discuss.python.org/t/alternative-type-first-annotation-syntax-type-name-value/109156 "2026-09-23T17:28:58Z")

</div>

Title: Alternative type-first annotation syntax: type: name = value Body: Summary I’d like to propose an alternative syntax for variable type annotations where the type precedes the variable name, as an optional comp…

---

## [Faster (lazier) dataclasses](https://discuss.python.org/t/faster-lazier-dataclasses/107744)

<div class="topic-metadata">

**Author:** [@DavidCEllis](https://discuss.python.org/u/DavidCEllis)\
**Replies:** 18\
**Last updated:** [September 23, 2026, 3:57pm UTC](https://discuss.python.org/t/faster-lazier-dataclasses/107744 "2026-09-23T15:57:13Z")

</div>

The short, short version Dataclass creation is slow, this is a recurring problem in the stdlib They are slow because they exec source code templates to create every method It turns out a lot of methods are never actuall…

---

## [Pre-PEP: UTF-8 String Representation](https://discuss.python.org/t/pre-pep-utf-8-string-representation/109197)

<div class="topic-metadata">

**Author:** [@methane](https://discuss.python.org/u/methane)\
**Replies:** 2\
**Last updated:** [September 23, 2026, 2:04pm UTC](https://discuss.python.org/t/pre-pep-utf-8-string-representation/109197 "2026-09-23T14:04:53Z")

</div>

I am considering using UTF-8 as Unicode’s internal representation. The potential benefits are: PEP 393’s Flexible String Representation (FSR) is an implementation detail and is not part of the Stable ABI. Some extensio…

---

## [Add "pycore\_pyconfig.h" to split the private configure](https://discuss.python.org/t/add-pycore-pyconfig-h-to-split-the-private-configure/109181)

<div class="topic-metadata">

**Author:** [@Locked-chess-official](https://discuss.python.org/u/Locked-chess-official)\
**Replies:** 9\
**Last updated:** [September 23, 2026, 11:11am UTC](https://discuss.python.org/t/add-pycore-pyconfig-h-to-split-the-private-configure/109181 "2026-09-23T11:11:13Z")

</div>

This idea is to use pycore\_pyconfig.h to avoid the macros not start with Py or \_Py go into the user codes. Maybe it can reduce the amount of modifications in the issue #157695. The private config macros will be moved to…

---

## [Protocol as a soft keyword, making structural typing a first-class citizen](https://discuss.python.org/t/protocol-as-a-soft-keyword-making-structural-typing-a-first-class-citizen/109139)

<div class="topic-metadata">

**Author:** [@mfish33](https://discuss.python.org/u/mfish33)\
**Replies:** 14\
**Last updated:** [September 22, 2026, 4:56pm UTC](https://discuss.python.org/t/protocol-as-a-soft-keyword-making-structural-typing-a-first-class-citizen/109139 "2026-09-22T16:56:34Z")

</div>

Hi everyone, Building on Guido’s comments at the recent PyCon US Typing Summit regarding the evolution of type hints, I’d like to propose elevating structural typing to a first-class language feature by introducing prot…

---

## [None-coalescing operator and null‑coalescing assignment](https://discuss.python.org/t/none-coalescing-operator-and-null-coalescing-assignment/107510)

<div class="topic-metadata">

**Author:** [@Rainwalker](https://discuss.python.org/u/Rainwalker)\
**Replies:** 65\
**Last updated:** [September 21, 2026, 11:14pm UTC](https://discuss.python.org/t/none-coalescing-operator-and-null-coalescing-assignment/107510 "2026-09-21T23:14:42Z")

</div>

\[Pre-PEP\] None-coalescing operator ?? and null-coalescing assignment ??= Author: Rainwalker Target version: Python 3.16 (or later) Status: Pre‑PEP (discussion) Note: This is a narrow subset of PEP 505 (no ?. or ?\[\]). …

---

## [Should json restrict string indentation to JSON whitespace?](https://discuss.python.org/t/should-json-restrict-string-indentation-to-json-whitespace/109060)

<div class="topic-metadata">

**Author:** [@jlsneto](https://discuss.python.org/u/jlsneto)\
**Replies:** 39\
**Last updated:** [September 19, 2026, 1:16pm UTC](https://discuss.python.org/t/should-json-restrict-string-indentation-to-json-whitespace/109060 "2026-09-19T13:16:22Z")

</div>

The json module accepts arbitrary strings for indent. Depending on the string and input data, this can produce invalid JSON or valid JSON with different values. For example: import json data = \[1, 2\] for indent in \["…

---

## [Specify skip= parameters to pdb.Pdb from command line or .pdbrc](https://discuss.python.org/t/specify-skip-parameters-to-pdb-pdb-from-command-line-or-pdbrc/109042)

<div class="topic-metadata">

**Author:** [@Melendowski](https://discuss.python.org/u/Melendowski)\
**Replies:** 3\
**Last updated:** [September 19, 2026, 12:57pm UTC](https://discuss.python.org/t/specify-skip-parameters-to-pdb-pdb-from-command-line-or-pdbrc/109042 "2026-09-19T12:57:19Z")

</div>

Problem pdb.Pdb accepts a skip parameter containing glob-style module-name patterns: pdb.Pdb(skip=\["django.\*", "some\_package.generated.\*"\]) However, this existing functionality cannot be configured when invoking pdb t…

---

## [\`unexpanduser\` counterpart to \`os.path.expanduser\`](https://discuss.python.org/t/unexpanduser-counterpart-to-os-path-expanduser/109079)

<div class="topic-metadata">

**Author:** [@calestyo](https://discuss.python.org/u/calestyo)\
**Replies:** 26\
**Last updated:** [September 18, 2026, 7:45pm UTC](https://discuss.python.org/t/unexpanduser-counterpart-to-os-path-expanduser/109079 "2026-09-18T19:45:34Z")

</div>

Hey. Would there be any interest in adding a counterpart for \`os.path.expanduser\` like: def unexpanduser(path): home\_directory = os.path.expanduser("~") if os.path.isabs(home\_directory) and os.path.isabs(path…

---

## [Docstrings for type aliases](https://discuss.python.org/t/docstrings-for-type-aliases/108901)

<div class="topic-metadata">

**Author:** [@bswck](https://discuss.python.org/u/bswck)\
**Replies:** 24\
**Last updated:** [September 18, 2026, 5:47pm UTC](https://discuss.python.org/t/docstrings-for-type-aliases/108901 "2026-09-18T17:47:04Z")

</div>

Hi! I propose preserving a string literal immediately following a type statement as the resulting alias object’s \_\_doc\_\_ attribute, with support in pydoc to display it in help(), and making that docstring retrievable fro…

---

## [Unifying Tool Directives in Python Comments](https://discuss.python.org/t/unifying-tool-directives-in-python-comments/109068)

<div class="topic-metadata">

**Author:** [@AlfredDU](https://discuss.python.org/u/AlfredDU)\
**Replies:** 26\
**Last updated:** [September 18, 2026, 5:14pm UTC](https://discuss.python.org/t/unifying-tool-directives-in-python-comments/109068 "2026-09-18T17:14:08Z")

</div>

Dear Friends, I recently noticed a recurring pattern in Python develop toolchains that seems worth discussing: Python tooling has accumulated a growing number of tiny, tool-specific DSLs hidden inside comments: # pyli…

---

## [Pattern matching on constants that aren't in a namespace (especially sentinels)](https://discuss.python.org/t/pattern-matching-on-constants-that-arent-in-a-namespace-especially-sentinels/107916)

<div class="topic-metadata">

**Author:** [@tmk](https://discuss.python.org/u/tmk)\
**Replies:** 70\
**Last updated:** [September 17, 2026, 10:32pm UTC](https://discuss.python.org/t/pattern-matching-on-constants-that-arent-in-a-namespace-especially-sentinels/107916 "2026-09-17T22:32:10Z")

</div>

With the recent addition of sentinels to Python 3.15, I would like to write code like this: from typing import NamedTuple TRANSPARENT = sentinel("TRANSPARENT") class Rgb(NamedTuple): r: int g: int b: int …

---

## [\`range()\` with optional inclusive \`stop\`](https://discuss.python.org/t/range-with-optional-inclusive-stop/106521)

<div class="topic-metadata">

**Author:** [@noelgolding](https://discuss.python.org/u/noelgolding)\
**Replies:** 24\
**Last updated:** [September 17, 2026, 6:31pm UTC](https://discuss.python.org/t/range-with-optional-inclusive-stop/106521 "2026-09-17T18:31:40Z")

</div>

I’m considering proposing an optional inclusive parameter for the built-in range() function and would welcome feedback before drafting a formal PEP. This would be a change to the existing range() signature only—no new sy…

---

## [A literal constructor for frozensets \[EDIT: already discussed in a PEP\]](https://discuss.python.org/t/a-literal-constructor-for-frozensets-edit-already-discussed-in-a-pep/109088)

<div class="topic-metadata">

**Author:** [@FLBPeriat](https://discuss.python.org/u/FLBPeriat)\
**Replies:** 2\
**Last updated:** [September 16, 2026, 5:06pm UTC](https://discuss.python.org/t/a-literal-constructor-for-frozensets-edit-already-discussed-in-a-pep/109088 "2026-09-16T17:06:25Z")

</div>

Structures such as lists, tuples, dictionaries, etc., have literal constructors, assert \[\] == list() assert () == tuple() assert {} == dict() but frozensets do not. To distinguish this from a dictionary, and to expand…

---

## [Make \`\_\_doc\_\_\` on sentinels writable](https://discuss.python.org/t/make-doc-on-sentinels-writable/109067)

<div class="topic-metadata">

**Author:** [@tmk](https://discuss.python.org/u/tmk)\
**Replies:** 5\
**Last updated:** [September 15, 2026, 10:27pm UTC](https://discuss.python.org/t/make-doc-on-sentinels-writable/109067 "2026-09-15T22:27:19Z")

</div>

(partly inspired by the discussion in this thread) This seems useful to be able to do: UNKNOWN = sentinel("UNKNOWN") UNKNOWN.\_\_doc\_\_ = "Sentinel to represent values that cannot be calculated" so that, e.g., sphinx can…

---

## [String.isplit (iterator-based split for strings)](https://discuss.python.org/t/string-isplit-iterator-based-split-for-strings/7533)

<div class="topic-metadata">

**Author:** [@bobkayakbob](https://discuss.python.org/u/bobkayakbob)\
**Replies:** 15\
**Last updated:** [September 15, 2026, 5:07pm UTC](https://discuss.python.org/t/string-isplit-iterator-based-split-for-strings/7533 "2026-09-15T17:07:33Z")

</div>

an iterator-based split functionality. I can’t tell you how many times I see: for substr in str.split(): match = operation(substr) if match: break with isplit, we needn’t split the whole string

---

## [Define a concurrency model (aka memory model) for Python](https://discuss.python.org/t/define-a-concurrency-model-aka-memory-model-for-python/108762)

<div class="topic-metadata">

**Author:** [@markshannon](https://discuss.python.org/u/markshannon)\
**Replies:** 32\
**Last updated:** [September 15, 2026, 3:38pm UTC](https://discuss.python.org/t/define-a-concurrency-model-aka-memory-model-for-python/108762 "2026-09-15T15:38:46Z")

</div>

Over the years there have been attempts to define a memory model, notably PEP 583 and many questions both on the bug tracker and here about expected semantics and atomicity of operations, e.g. What is Thread Safety as ap…

---

## [Function-level (indent-less) "with" to do cleanup when function exits](https://discuss.python.org/t/function-level-indent-less-with-to-do-cleanup-when-function-exits/108958)

<div class="topic-metadata">

**Author:** [@techvslife](https://discuss.python.org/u/techvslife)\
**Replies:** 38\
**Last updated:** [September 15, 2026, 1:14pm UTC](https://discuss.python.org/t/function-level-indent-less-with-to-do-cleanup-when-function-exits/108958 "2026-09-15T13:14:52Z")

</div>

This is a suggestion for a minor Python syntax enhancement (to “with” statements), but it may not be of wide interest or there may be objections I haven’t considered. I often find myself wanting to have context-managed r…

---

## [Differentiate between variadic and non-variadic functions in ctypes](https://discuss.python.org/t/differentiate-between-variadic-and-non-variadic-functions-in-ctypes/99015)

<div class="topic-metadata">

**Author:** [@A-Paint-Brush](https://discuss.python.org/u/A-Paint-Brush)\
**Replies:** 7\
**Last updated:** [September 15, 2026, 8:42am UTC](https://discuss.python.org/t/differentiate-between-variadic-and-non-variadic-functions-in-ctypes/99015 "2026-09-15T08:42:48Z")

</div>

Proposal Currently, ctypes.\_CFuncPtr objects always allows you to call it with more arguments than the length of .argtypes. I find this behavior strange because it means accidently passing extra arguments can go unnotice…

---

## [Python API exposure mechanisms (public/internal) - determining status quo](https://discuss.python.org/t/python-api-exposure-mechanisms-public-internal-determining-status-quo/108869)

<div class="topic-metadata">

**Author:** [@timhoffm](https://discuss.python.org/u/timhoffm)\
**Replies:** 38\
**Last updated:** [September 14, 2026, 6:52pm UTC](https://discuss.python.org/t/python-api-exposure-mechanisms-public-internal-determining-status-quo/108869 "2026-09-14T18:52:50Z")

</div>

Motivation and scope This is a summary of the API exposure mechanisms currently used in Python, i.e. whether interaction with names from outside of the namespace they live in is intended and supported. The primarily rel…

[Next page](https://discuss.python.org/c/ideas/6.md?page=1)
