-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PEP 795: Deep Immutability in Python #4468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b2bf4aa
to
7cedb55
Compare
peps/pep-0795/sharing1.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a programmatic/text source that this file was created from? If so, it would be useful to include that, and also consider using an SVG file rather than a PNG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. We followed PEP12 which says:
Lines 604 to 605 in b5ae2b1
Currently, SVG must be avoided due to compatibility issues with the | |
PEP build system. |
Maybe this is outdated instructions?
Currently the file was extracted from Keynote which is macOS-only. We could redraw this in a more accessible format perhaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can now support & prefer SVG files. If Keynote will export an SVG, that should be fine? I had wondered if you'd used e.g. TikZ or graphviz to make the image.
Please avoid force pushing, we squash-merge all PRs. |
For the next PEP, please wait until the initial PR is merged before opening the PEP discussion, because we want to share the official peps.python.org URL and not the PR preview that will be deleted at some POINT. (Pre-PEP discussions can be opened at any time.) And especially please wait until the sponsor had confirmed sponsorship, as we the PEP number only gets officially assigned then and it can cause confusion to re-assign numbers later. Please see PEP 1 for more details. https://peps.python.org/pep-0001/#submitting-a-pep Thank you! |
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
============= | ||
|
||
Note: our current prototype implementation was authored on-top of | ||
Python 3.12. To avoid blocking on rebasing on 3.14 to force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be for 3.15 at this point.
themselves using ``register_freezable(type)``. Example: | ||
|
||
.. code-block:: Python | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably add a C API function for this too.
x = 0 | ||
def foo(a = False): | ||
nonlocal x | ||
if a: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a: | |
if a: |
single reference count could be used to track the lifetimes of | ||
all the objects in such a strongly connected component (SCC). | ||
|
||
We plan to extend the freeze logic with a SCC analysis that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We plan to extend the freeze logic with a SCC analysis that | |
We plan to extend the freeze logic with an SCC analysis that |
``ob_tid`` would allow for standard mutable thread local objects to | ||
remain the fast path, and is our preferred alternative. | ||
|
||
The extensions use use SCC calculations to detect cycles in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extensions use use SCC calculations to detect cycles in | |
The extensions to use SCC calculations to detect cycles in |
|
||
3. The type ``NotFreezable`` which is an empty type which cannot be made immutable and can be used as a super class to classes whose instances should not be possible to freeze | ||
|
||
4. The type ``NotFreezableError`` which is raised on an attempt to mutate an immutable object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this for an attempt to freeze and unfreezable object? Below, it says it raises a TypeError
when trying to mutate an immutable object.
Basic requirements (all PEP Types)
pep-NNNN.rst
), PR title (PEP 123: <Title of PEP>
) andPEP
headerAuthor
orSponsor
, and formally confirmed their approvalAuthor
,Status
(Draft
),Type
andCreated
headers filled out correctlyPEP-Delegate
,Topic
,Requires
andReplaces
headers completed if appropriate.github/CODEOWNERS
for the PEPStandards Track requirements
Python-Version
set to valid (pre-beta) future Python version, if relevantDiscussions-To
andPost-History
📚 Documentation preview 📚: https://pep-previews--4468.org.readthedocs.build/