# Strict Mode for Protecting Built-in Functions

**URL:** <https://discuss.python.org/t/strict-mode-for-protecting-built-in-functions/81858>\
**Category:** Ideas\
**Created:** [February 23, 2025, 3:39pm UTC](https://discuss.python.org/t/strict-mode-for-protecting-built-in-functions/81858 "2025-02-23T15:39:08Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![jamestwebber](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/jamestwebber/32/12799_2.png) [@jamestwebber](https://discuss.python.org/u/jamestwebber)\
**Post date:** [February 23, 2025, 4:55pm UTC](https://discuss.python.org/t/strict-mode-for-protecting-built-in-functions/81858/8 "2025-02-23T16:55:34Z")

</div>

I floated the idea of [freezing modules for import speed](https://discuss.python.org/t/make-more-of-the-standard-library-import-on-demand/76311/2) a little bit ago, but Steve Dower poured some cold water on the idea\[1\]. It’s a little bit related to this idea, though–if a set of stdlib modules were frozen, they could be marked read-only and more aggressively optimized

One way to implement this is as a runtime flag, e.g. `python -X frozen-std=true` or something, which is by default off. In that case, it _could_ become the default behavior over the course of a few versions, if the performance improvement was worth it. I suspect it would be worth it for a majority of users who aren’t modifying modules in the stdlib at all.

* * *

1. apparently it doesn’t speed things up much

---

_[View the full topic](https://discuss.python.org/t/strict-mode-for-protecting-built-in-functions/81858)._
