Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Makeframe.f_locals.copy() return a snapshot dict off_locals #118921

Closed
Assignees
gaogaotiantian
Labels
type-featureA feature request or enhancement
@gaogaotiantian

Description

@gaogaotiantian

Feature or enhancement

Proposal:

Per PEP 667,frame.f_locals is now a write-through proxy (FrameLocalsProxy) for underlying fast local variables. In the beginning we did not implement thecopy() method because we thinkdict(frame.f_locals) is a more explicit way to achieve the snapshot. However, there are existing code that's usingframe.f_locals.copy() to take a snapshot. Moreover,types.MappingProxyType({}).copy() returns the copy of the underlying mapping so it's not unprecedented for aproxy.copy() to return a dict.

Thus, we should implementcopy() method forFrameLocalsProxy and make it return a dict of snapshot of the current local variables.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/pep-667-consistent-views-of-namespaces/46631/26

Linked PRs

Metadata

Metadata

Labels

type-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp